摘要:
''' 不换行 \t 补tab键 ''' print("原始效果:") print("hello") print("world") print("更新后的 不换行效果:") print("hello",end="") print("world") print("原始效果:") print("hell 阅读全文
posted @ 2023-03-27 22:15
胖豆芽
阅读(24)
评论(0)
推荐(0)
摘要:
''' while 求1到100的和 ''' end=1 result=0 while end<=100: result+=end end+=1 print("result:"+str(result)) ''' while 设置一个范围1到100的随机数变量 猜数字 提示大了或者小了 无限次猜测 ' 阅读全文
posted @ 2023-03-24 21:37
胖豆芽
阅读(52)
评论(0)
推荐(0)
摘要:
''' 定义一个数字 1到10 随机产生 ,通过3次判断来猜出数字 ''' import random num=random.randint(1,10) print(num) if int(input("第一次,猜猜数字是:")) != num: print("第一次猜错了") if int(inp 阅读全文
posted @ 2023-03-23 23:04
胖豆芽
阅读(250)
评论(0)
推荐(0)
摘要:
''' 定义一个数字 1到10 随机产生 ,通过3次判断来猜出数字 ''' import random num=random.randint(1,10) print(num) 阅读全文
posted @ 2023-03-23 22:33
胖豆芽
阅读(198)
评论(0)
推荐(0)
摘要:
''' if判断语句 ''' age=18; age2=10; if age>=18: print("成年人") ''' if判断语句 ''' age=input("请输入你的年纪"); if int(age) <=18: print(f"你{age}岁了,免费玩耍") print("大于18岁,收 阅读全文
posted @ 2023-03-22 21:46
胖豆芽
阅读(63)
评论(0)
推荐(0)
摘要:
''' 比较运算符 ''' num1="abc" num2="abc" print(f"num1和num2的比较结果{num1==num2}") 阅读全文
posted @ 2023-03-22 21:17
胖豆芽
阅读(28)
评论(0)
推荐(0)
摘要:
''' 股价计算小程序 小数点后2位数 ''' name="recoo" stock_price=1 stock_code=123456 stock_price_daily_growth_factor=1.2 growth_days=7 message=f"公司是{name},股票价格:{stock 阅读全文
posted @ 2023-03-21 23:05
胖豆芽
阅读(52)
评论(0)
推荐(0)
摘要:
1.转义字符\后面的符号被隐去#转义字符name="\"转义字符\""print(name)2.拼接整数型变量 2.1 %s 占字符串 2.2 %d 占数字类型 2.3 %f 占浮点型 ''' 字符串格式化 ''' #占位符 拼接变量 class_num=57 avg_salary=10 messa 阅读全文
posted @ 2023-03-21 21:47
胖豆芽
阅读(68)
评论(0)
推荐(0)
摘要:
'''1.打开文件open('info.json',mode='r',encoding='utf-8')参数1 file 打开文件的名次,类型是字符串,文件路径建议用相对路径参数2 默认值是只读取 r read;只写打开 w write;追加打开 a append 注意在末尾写内容;返回值 返回的是 阅读全文
posted @ 2023-03-20 23:29
胖豆芽
阅读(24)
评论(0)
推荐(0)
摘要:
1新建一个类继承unittest.TestCase class TestCase(unittest.TestCase): 2.导入unittest import unittest 3.写入一个以test开头的方法 def test_01_login(self): 阅读全文
posted @ 2023-03-20 22:18
胖豆芽
阅读(17)
评论(0)
推荐(0)
浙公网安备 33010602011771号