标签:构建 质数 alt 选择结构 输入 停止 使用 for语句 pytho
1 x = int(input("请输入您的总分:")) 2 if x >= 90: 3 print(‘优‘) 4 elif x>=80: 5 print(‘良‘) 6 elif x >= 70: 7 print(‘中‘) 8 elif x >= 60: 9 print(‘合格‘) 10 else: 11 print(‘不合格‘)
x = int(input("请输入您的总分:")) if x >= 90: print(‘优‘) elif x>=80: print(‘良‘) elif x >= 60: print(‘合格‘) elif x >= 70: print(‘中‘) else: print(‘不合格‘)
for num in range(10,20): for i in range(2,num): if num % i == 0: j = num/i print("%d等于%d*%d" % (num,i,j)) break else: print("%d是一个质数" % num)
count = 0 while count < 5: print(count, " is less than 5") count = count + 1 else: print(count, " is not less than 5")
for i in range(10): if i%2 == 0: continue print(i) if i>=7: break else: print("循环结束") 3 7
标签:构建 质数 alt 选择结构 输入 停止 使用 for语句 pytho
原文地址:http://www.cnblogs.com/hui520/p/6390432.html