Note on python__2021-07-05Python练习使用if-else条件选择+list列表——>age_selector
Posted topia_csdn
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Note on python__2021-07-05Python练习使用if-else条件选择+list列表——>age_selector相关的知识,希望对你有一定的参考价值。
age = int( input ('your age '))
print(type(age))
age_limite = [80,60,38,18,12,3,0]
print(type(age_limite))
print(type(age))
if age >= age_limite[0]:
print('you\\'re really old')
elif age >= age_limite[1]:
print('you\\'re old')
print('you have utile %s year to be really old ' %(age - age_limite[1]) )
elif age >= age_limite[2]:
print('you\\'re middle-age')
print('you have utile %s year to be old ' %(age - age_limite[2]) )
elif age >= age_limite[3]:
print('you\\'re an adult')
print('you have utile %s year to be middle-age' %(age - age_limite[3]) )
elif age >= age_limite[4]:
print('you\\'re a big child')
print('you have utile %s year to be an adult ' %(age - age_limite[4]) )
elif age >= age_limite[5]:
print('you\\'re a little child')
print('you have utile %s year to be a big child ' %(age - age_limite[5]) )
elif age >= age_limite[6]:
print('you\\'re an infant')
print('you have utile %s year to be a little child' %(age - age_limite[6]) )
else :
print('please input a real age number')
以上是关于Note on python__2021-07-05Python练习使用if-else条件选择+list列表——>age_selector的主要内容,如果未能解决你的问题,请参考以下文章
Note on python__2021-07-05Python练习使用字典dict+list
Note on python__2021年7月2日Python练习使用list和tuple
Note on python__2021-07-05Python练习使用if-else条件选择+list列表——>age_selector