Commit f691c14c by BellCodeEditor

save project

parent f9b58e3c
dt={'1':1,'1':2}
k=input("你想买什么?")
n=input("购买的数量:")
in k in dict:
cost=dict[k] *int(n)
print('你买的'+k+'一共'+str(cost)+'mn')
else:
print("没有")
\ No newline at end of file
# 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典
dict_hero={'赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98,30,'丁二',37,'孙五',52,'王猛',89,'周亮',98}
print(dict_hero['赵一'])
# 直接运行以下代码,说说你的发现:
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
x='123'
#将 str 转为int
int(x)
#将 str 转为float
float(x)
#将float int 转为str
str(x)
\ 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