if 语句
Posted yhrfighting123
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了if 语句相关的知识,希望对你有一定的参考价值。
猜年龄
age_of_principal = 56 #基础 guess_age=int(input(">>:")) if guess_age == age_of_principal: print("Yes,you get it..") else: print("No,it‘s wrong") age_of_principal = 56 #进阶 guess_age=int(input(">>:")) if guess_age == age_of_principal: print("Yes,you get it..") elif guess_age > age_of_principal: print("You should try smaller") else: print("try bigger")
分数评级
score = int(input("please input you score<<:")) if score > 90: print("A") elif score > 80: print("B") elif score > 70: print("C") elif score > 60: print("D") else: print("You are not fit to study")
以上是关于if 语句的主要内容,如果未能解决你的问题,请参考以下文章