列表的应用

import turtle
turtle.speed(10)
colors=['red','purple','blue','green','yellow','orange','black','gold','brown',]

for i in range(200):
    turtle.pencolor(colors[i%9])
    turtle.forward(i)
    turtle.left(60)


turtle.done()

l = [['Apple','Google','Microsoft'],\
     ['Java','Python','Ruby','PHP'],\
     ['Adam','Bart','Lisa']\
     ]

names= ['Michael','Bob','Tracy']  #list
print(names[1])
scores = [95,75,85]  #list

d = {'Michael':95,'Bob':75,'Tracy':85}  #dict

posted on 2018-06-04 16:36  方忻仪  阅读(134)  评论(0)    收藏  举报