Commit 86e78e9a by BellCodeEditor

save project

parent e21ed867
Showing with 41 additions and 9 deletions
try:
age = int(input("你今年几岁了"))
except:
print("要输入整数啊")
else
print("程序结束")
\ No newline at end of file
try:
age = int(input("你今年几岁了"))
except:
print("要输入整数啊")
else:
if age < 18:
print("不可以喝酒哦")
print("程序结束")
\ No newline at end of file
def new_input():#新建一个函数
total = []#建立一个空价格列表
while True:
unit = input("请输入(q退出):")#输入内容的提示
if unit == "q":#如果输入q
break#终止程序
else:#否则
try:
unit = int(unit)#输入一个整数
except:
print("请输入一个数字")#如果我输入的不是整数的提示
else:
total.append(unit)#如果我输入的是整数的话就把这个整数添加到total中
print("-"*30)#一个分界线
print(total)#输出现在的价格
new_input()#调用函数
\ No newline at end of file
total = [] dict_hero={'猴三':10,'猴一':21,'猴五':22,'猴队长':30}
while True: print(dict_hero)
unit= input("请输入:") \ No newline at end of file
if unit== 'q':
break
else:
total.append(unit)
print(total)
\ No newline at end of file
list_hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98]
dict_hero={'赵一':30,'丁二':37,'孙五':52,'王猛':89,'周亮':98}
print(len(list_hero))
print(len(dict_hero))
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment