7-3
number = input()
if int(number) % 10 == 0:
print("yes")
else:
print("no")
输出结果:
10
yes
15
no
7-5
while True:
age = input("How old are you?(input quit to quit)\n")
if age == "quit":
exit()
elif int(age) < 3:
print("you are free.")
elif int(age) >= 3 and int(age) <= 12:
print("you have to pay 10 dollars.")
else:
print("you have to pay 15 dollars.")
输出结果:
How old are you?(input quit to quit)
2
you are free.
How old are you?(input quit to quit)
10
you have to pay 10 dollars.
How old are you?(input quit to quit)
15
you have to pay 15 dollars.
How old are you?(input quit to quit)
12
you have to pay 10 dollars.
How old are you?(input quit to quit)<