猜年龄,如果大了提示小点,如果小了,提示大点
涉及的知识点:
1、变量
2、注释
3、接收交互式的输入
4、类型转换
5、while循环
6、if..elif..else多条件分支语句
# Author: fansik # Description: Guess age age_of_fansik = 70 while True: guess_age = int(input("please enter age : ")) if guess_age == age_of_fansik: print("Congratulations, You‘re Right") break elif guess_age > age_of_fansik: print("It‘s too big, smaller") continue else: print("It‘s too small, Bigger") continue
guess_age
时间: 2024-10-12 15:30:57