lundi 18 février 2019

Python 3.7.2 Elif not working only if statement

when I print d, the dictionary, only white gets changed into "Mindful." the rest stay as the color.

clrs = ['white', 'blue', 'black', 'purple', 'pink', 'yellow']

d = {}

while True: spawn = int(input('enter how many creatures to spawn: ')) for x in range(spawn): clr = random.choice(clrs) print (clr) a=Turtle() a.speed(0) a.penup() a.shape("circle") a.color(clr) a.goto(random.randint(-500,500),random.randint(-500,500)) if clr=='white': clr='Mindful' elif clr=='blue': clr=='Anima' elif clr=='black': clr=='Dimension' elif clr=='purple': clr=='Enigma' elif clr=='pink': clr=='Light' elif clr=='yellow': clr=='Golem' else: print ('wtf how have you done this') d["ball{0}".format(x)]=clr print (d)

wn.mainloop()

Aucun commentaire:

Enregistrer un commentaire