3判断考试成败的程序(input,if,else)

score = input("请输入你的考试成绩:")
score = int(score)
if(score>=60 and score<=100):

  print("及格")

elif(score<0):

  print("成绩不能是负数")

elif(score>100):

  print("最多考100分")

else:

  print("不及格")

 

if知识点

if(条件)冒号

  {

  if控制的语句

}

 

强制类型转换知识点

int(6.6)的结果是6

score = int(input("请输入你的成绩"))

float(x) 可以把x转换成浮点型

posted @ 2020-02-25 17:35  写博客是第一驱动力  阅读(442)  评论(0)    收藏  举报