Hi there, i dont really know why but a statement wich i would guess should be actually true seems to be false or is this my false?
loop:
coins = self.findItems()
coinIndex = 0
# Schreibe dies in eine Schleife, die über alle Münzen läuft.
coin = coins[coinIndex]
while True:
# Goldmünzen haben einen Wert von 3.
if coin.value == 3: #this statement should be true shouldnt it?
self.say("The code is working but im dumb")
self.moveXY(coin.x, coin.y)
coinIndex += 3
# Sammle nur Goldmünzen.
else self.say("The statement is false")
Or do i kind of have to create a move to next coin as target thingy because it always targets the same coin wich is not a gold coin resulting that the condition is always false? If yes, how do i do that?
No, my problem is that theres no coin.value with the value of 3 and the statement stays false. Im aware of the fact that the while True creates an infinite loop, but i wanted to take care of that later. The problem is that it always uses the else statement
coins is a list, and you want to go through all the elements of that list. In python (and most programming languages) the first element has an index of zero. In order to check all the coins, you have to increase that index until you go through the full list.