#I'm trying to call a search of a list with if statements and then add values to a co-ordinate that I can #call to draw a object in turtle. Similar solutions are welcome, but i really would like to know where I #am going wrong in my thinking here.
fixed_data_set_01 = [['Competitor A', 'Right'],
['Competitor A', 'Down'],
['Competitor A', 'Down'],
['Competitor A', 'Left'],
['Competitor A', 'Up']]
def list_searcher():
global fixed_data_set_01
d = len(fixed_data_set_01)
f = 0 # looping variable to search through index
y = 0 # defining y coord
x = 0 # defining x coord
for lister in range(d):
print(fixed_data_set_01[f])
f = f + 1
p = fixed_data_set_01[f]
if 'Up' in p:#if up is in the move set add value to y coord for competitor
y = y + 90
print(y,x)# testing
return y
if 'Down' in p:#if down is in the move set add value to y coord for competitor
y = y - 90
print(y,x)# testing
return y
if 'Left' in p:#if left is in the move set add value to x coord for competitor
x = x - 120
print(y,x)
return x
if 'Right' in p:#if right is in the move set add value to x coord for competitor
x = x + 120
print(y,x) # testing
return x
list_searcher()
Aucun commentaire:
Enregistrer un commentaire