python for循环连续输入五个成绩判断等级_python 输入输出 条件判断 循环

1、条件判断

score = int(input("请输入学生成绩:"))

if score>100 and score <0:

print("请输入正确的成绩")

elif score<=100 and score >=90:

print("优秀")

elif score < 90 and score >= 80:

print("良好")

elif score <80 and score >= 60:

print("及格")

else:

print("不及格")

#若if代码块中无内容,可使用pass,pass代表空代码块,无实际意义

a = 10

if a%2 == 0:

pass

else:

print('该数为奇数')

2、while循环

count =0

while count<4:

print(count)

count = count+1

# break 循环中遇到break立即结束

# continue 循环里遇到continue就结束本次循环

print('----------------------------')

import random

number = random.randint(1,100)

print(number)

count = 0

while count <7:

guess = int(

你可能感兴趣的:(python)