Commit 2301b614 by BellCodeEditor

save project

parent 0263e615
Showing with 69 additions and 3 deletions
list_hero=['猴三',10,'猴一',21,'猴五',22,'猴队长',29,'猴七',30] import turtle
turtle.pencolor('orange')
\ No newline at end of file turtle.fillcolor('yellow')
turtle.begin_fill()
for i in range(20):
for j in range(4):
turtle.forward(100)
turtle.left(90)
turtle.left(18)
turtle.end_fill()
turtle.hideturtle()
turtle.done()
\ No newline at end of file
import turtle
turtle.fillcolor()
turtle.pencolor('red')#定义画笔
turtle.fillcolor('yellow') #填充
turtle.begin_fill() #开始填充
for i in range(20): #20次
for j in range(4): #40
turtle.forward(100)
turtle.left(90)
turtle.left(18)
turtle.end_fill() #结束填充
turtle.hideturtle()#隐藏箭头
turtle.done()
\ No newline at end of file
'''
字典名:dt
张三 18
李四 19
输出张三值
字典名={键名:值} #字典的格式 '''
#定义字典dt
dt={'张三':18,'李四':19}
#输出张三的值
#print(dt['张三']) #字典[键名]
#将‘张三 ’的值改为20
dt['张三']=20
#print(dt['张三'])
#增加'王五' 21
dt['王五']=21 #如果王五存在于字典中,它就修改王五的值,否则,它就自动增加王五这一项
#遍历字典dt
for k in dt:
print(k)
'''
# 提取猴队长的臂力值
print(dict_hero['猴队长'])
# 修改猴七的臂力值为32
dict_hero['猴七']=32
print(dict_hero)
'''
\ No newline at end of file
# 神奇百货中的物品已经帮你创建好啦,接下来要看你的了~
dict= {'可口可乐':3,'旺仔牛奶':4,'农夫山泉':1,'辣条':3,'巴西烤肉':2,'果冻':4,'乐事':5,'奥利奥':10,'巧克力':6}
k=input('你想买什么啊?')
if k in dict:
print(k+'价格'+str(dict[k])+'元')
else:
print("你要的商品不在清单中")
\ 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