上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 65 下一页
摘要: ''' for循环 ''' name="fqs" for x in name: print(x) '''for循环输出name中有几个y'''name="yyyyygfdskkklliuyyhhhhhhhhhhhhuuuu"i=1for x in name: print(x) if x=="y": 阅读全文
posted @ 2023-03-28 22:33 胖豆芽 阅读(23) 评论(0) 推荐(0) 编辑
摘要: ''' 99乘法表 ''' #1*1=1 第一行 行j 列i 第一行有1列 i=1 j=1 print(str(i)+"*"+str(j)+"="+str(i*j)) #1*2=1 2*2=4 第二行 行j 列 第二行有2列 i=1 j=2 print(str(i)+"*"+str(j)+"="+s 阅读全文
posted @ 2023-03-28 21:53 胖豆芽 阅读(355) 评论(0) 推荐(0) 编辑
摘要: ''' 不换行 \t 补tab键 ''' print("原始效果:") print("hello") print("world") print("更新后的 不换行效果:") print("hello",end="") print("world") print("原始效果:") print("hell 阅读全文
posted @ 2023-03-27 22:15 胖豆芽 阅读(19) 评论(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 胖豆芽 阅读(32) 评论(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 胖豆芽 阅读(121) 评论(0) 推荐(0) 编辑
摘要: ''' 定义一个数字 1到10 随机产生 ,通过3次判断来猜出数字 ''' import random num=random.randint(1,10) print(num) 阅读全文
posted @ 2023-03-23 22:33 胖豆芽 阅读(81) 评论(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 胖豆芽 阅读(37) 评论(0) 推荐(0) 编辑
摘要: ''' 比较运算符 ''' num1="abc" num2="abc" print(f"num1和num2的比较结果{num1==num2}") 阅读全文
posted @ 2023-03-22 21:17 胖豆芽 阅读(20) 评论(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 胖豆芽 阅读(32) 评论(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 胖豆芽 阅读(48) 评论(0) 推荐(0) 编辑
上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 65 下一页