Commit aba7874c by BellCodeEditor

auto save

parent 98f24605
Showing with 12 additions and 13 deletions
# 这是悟空为花果山小猴做臂力测试的程序代码 cost={'可口可乐':4,'旺仔牛奶':4,'农夫山泉':6,'卫牛辣条':1,'巴西烤肉':888,'喜之妞果冻':4,'坏事薯片':5,'巧克力':6,'小小口香糖':5}
name=input('你叫啥名啊?') k=input('请输入物品名称?')
power=int(input('你臂力多少啊?')) v=input('请输入物品价格?')
list_hero=['猴三',10,'猴一',21,'猴五',22,'猴队长',29,'猴七',30] if k in cost:
for i in range(len(list_hero)): if float(v)<cost[k]:
if i%2==1 and list_hero[i]>=power: print(k+'降价了,现价'+v+'元')
list_hero.insert(i-1,name) else:
list_hero.insert(i,power) print(k+'涨价,我们不买')
break else:
print(list_hero) cost[k] = float(v)
# 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典 print(k+'的价钱'+v+'元已上传')
dict_hero= \ No newline at end of file
print(dict_hero)
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