193138許嶺
提問(wèn)人:wx20211012150229發(fā)布時(shí)間:2021-10-19
# 公園門(mén)票
while True:
age = input("請(qǐng)輸入游客年齡:")
if age == 'quit':
break
elif int(age) > 12:
print("您的門(mén)票價(jià)格為15元")
elif 3 <= int(age) <= 12:
print("您的門(mén)票價(jià)格為10元")
elif int(age) < 3:
print("您無(wú)需門(mén)票")
# 列表使用
names = ['張三', '李四', '王五', '趙六']
for i in names:
print(i)
for j in names:
print(f'你好呀!{j}')
# 3的倍數(shù)
number = []
for i in range(3, 31):
if i % 3 == 0:
number.append(i)
for j in range(len(number)):
print(number[j], end=" ")
while True:
age = input("請(qǐng)輸入游客年齡:")
if age == 'quit':
break
elif int(age) > 12:
print("您的門(mén)票價(jià)格為15元")
elif 3 <= int(age) <= 12:
print("您的門(mén)票價(jià)格為10元")
elif int(age) < 3:
print("您無(wú)需門(mén)票")
# 列表使用
names = ['張三', '李四', '王五', '趙六']
for i in names:
print(i)
for j in names:
print(f'你好呀!{j}')
# 3的倍數(shù)
number = []
for i in range(3, 31):
if i % 3 == 0:
number.append(i)
for j in range(len(number)):
print(number[j], end=" ")
繼續(xù)查找其他問(wèn)題的答案?
相關(guān)視頻回答
點(diǎn)擊加載更多評(píng)論>>