0
我有一個烏龜繪製的數字列表,但我希望筆的顏色根據列表中數字的值進行更改。如何從列表中的值更改烏龜的筆顏色?
colors = ["red", "orange", "green", "cyan", "blue", "purple", "magenta", "pink"]
digits = map(int,str(5))
for number in digits:
*code to change pen color to value of "index(number)" (in this case purple)*
t.right(number*10)
只以5爲例,有沒有辦法根據列表中元素的值來改變顏色?
我對Python有點新,所以在此先感謝您的幫助。
是的,這就是我一直在尋找的!謝謝! – Ben