摘要: #输出等腰三角形 i = 1 while i <= 5: print(" "*(5-i),end = "") j = 1 while j <= 2*i-1: print("*",end = "") j += 1 print("") i += 1 #for循环输出9*9乘法表 for j in ran 阅读全文
posted @ 2024-03-21 18:44 吃菜罐头 阅读(29) 评论(0) 推荐(0)
摘要: #if语句嵌套 if int(input("输入身高=")) > 120 : if int(input("输入vip等级=")) > 3: print("免票") else : print("买票") else : print("免票") #continue 参与循环 i = 1 while i < 阅读全文
posted @ 2024-03-16 17:08 吃菜罐头 阅读(27) 评论(0) 推荐(0)
摘要: #引入常规库 import math print(math.fabs(-5.5))print(math.floor(5.5)) print(math.ceil(5.5)) #随机数 import random a = random.randint(1,10) print(a) #找钱问题 ##随机输 阅读全文
posted @ 2024-03-13 21:36 吃菜罐头 阅读(44) 评论(0) 推荐(0)
摘要: #逻辑运算 ##输入三角形的3边,如果两边的长度大于第三条边,则代表是一个合法三角形 a = float(input("边长1=")) b = float(input("边长2=")) c = float(input("边长3=")) print(a+b>c and a+c>b and b+c>a) 阅读全文
posted @ 2024-03-13 20:55 吃菜罐头 阅读(67) 评论(0) 推荐(0)