Commit e38686fb by BellCodeEditor

auto save

parent 98f24605
Showing with 44 additions and 11 deletions
# 这是悟空为花果山小猴做臂力测试的程序代码 # 这是悟空为花果山小猴做臂力测试的程序代码
name=input('你叫啥名啊?') # name=input('你叫啥名啊?')
power=int(input('你臂力多少啊?')) # power=int(input('你臂力多少啊?'))
list_hero=['猴三',10,'猴一',21,'猴五',22,'猴队长',29,'猴七',30] # list_hero=['猴三',10,'猴一',21,'猴五',22,'猴队长',29,'猴七',30]
for i in range(len(list_hero)): # for i in range(len(list_hero)):
if i%2==1 and list_hero[i]>=power: # if i%2==1 and list_hero[i]>=power:
list_hero.insert(i-1,name) # list_hero.insert(i-1,name)
list_hero.insert(i,power) # list_hero.insert(i,power)
break # break
print(list_hero) # print(list_hero)
# 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典 # 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典
dict_hero= # dict_hero={'猴三':10,'猴一':21,'猴五':22,'猴队长':29,'猴七':30}
print(dict_hero) # dict_hero['后屋']=30
# #添加一个新元素 孙悟空 600
# if "孙悟空" in dict_hero:
# print(dict_hero['孙悟空'])
# print(dict_hero)
# hp={"可乐":3,"雷碧":5,"农夫三拳":6,"六个核弹":8,"薯片":15,"矿泉水":100,"绿茶":3}
# k = input("你想要买什么东西?")
# if k in hp:
# print("你好,你的"+k+"需要支付"+str(hp[k])+"元")
# else:
# print("不好意思,没有,")
cj = {"张三":30,"李四":50,"孙五":60,"张甲":80}
k = input("输入您的姓名:")
v = input("输入你的成绩:")
if k in cj:
if int(v)>cj[k]:
cj[k]=int(v)
print("恭喜你,你的成绩更新为"+v+"分")
else:
print("更新失败")
else:
cj[k]=int(v)
print("恭喜你"+k+"你的成绩上传成功")
\ 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