3.3 案例:成年人判断讲解
案例:
通过键盘输入age进行判断,如果判断年龄是否成人判断票价
print("欢迎来到游乐园,请说出你的年龄")
age = int(input("输入你的年龄:"))
if age >= 18:
print("你已经成年,需要买票")
print("游玩愉快")Last updated
Was this helpful?
通过键盘输入age进行判断,如果判断年龄是否成人判断票价
print("欢迎来到游乐园,请说出你的年龄")
age = int(input("输入你的年龄:"))
if age >= 18:
print("你已经成年,需要买票")
print("游玩愉快")Last updated
Was this helpful?
Was this helpful?