0
For Loop
https://code.sololearn.com/cClC2UWK9qUY/?ref=app When I run the code I expected this result: 1. Dog 2. Cat 3. Hamster But instead is just 1. 1. 1. Can someone tell me whats wrong with the code?
2 Answers
+ 1
You have a variable inside the loop and with each new run through the loop it is redefined by 1 again
+ 1
x must be outside the for loop