You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
self.say(len(coins))
bottom = [i for i in coins if i.pos.y <= 51-(13/17)*abs(i.pos.x-60)]
coins = [i for i in bottom if i.pos.x>self.pos.x]
self.say(len(coins))
the first self.say worked fine, the second was broken.
I tried breaking both of the comprehensions into simple for loops and it worked fine:
bottom = []
for i in coins:
if i.pos.y <= 51-(13/17)*abs(i.pos.x-60):
bottom.append(i)
coins = []
for i in bottom:
if i.pos.x>self.pos.x:
coins.append(i)
When I tried it with the first comprehension and the second as a loop I got an error on i.pos.x complaining the null doesn't have a .pos.
bottom = [i for i in coins if i.pos.y <= 51-(13/17)*abs(i.pos.x-60)]
coins = []
for i in bottom:
if i.pos.x>self.pos.x:
coins.append(i)
I tried the other direction with the bottom as a list and the coins as a comprehension:
bottom = []
for i in coins:
if i.pos.y <= 51-(13/17)*abs(i.pos.x-60):
bottom.append(i)
coins = [i for i in bottom if i.pos.x>self.pos.x]
And it worked. So apparently the issue is in the first comprehension.
The text was updated successfully, but these errors were encountered:
I was attempting these lines of code:
the first self.say worked fine, the second was broken.
I tried breaking both of the comprehensions into simple for loops and it worked fine:
When I tried it with the first comprehension and the second as a loop I got an error on i.pos.x complaining the null doesn't have a .pos.
I tried the other direction with the bottom as a list and the coins as a comprehension:
And it worked. So apparently the issue is in the first comprehension.
The text was updated successfully, but these errors were encountered: