cords = 0 swiched = 100 done = False while True: cords += 1 if done == False: swiched = cords done = True print(swiched)
Here is what the above code is Doing:
1. It’s creating a variable called cords and setting it to 0.
2. It’s creating a variable called swiched and setting it to 100.
3. It’s creating a variable called done and setting it to False.
4. It’s creating a while loop that will run forever.
5. It’s adding 1 to the variable cords.
6. It’s checking if the variable done is False.
7. If done is False, it’s setting the variable swiched to the value of the variable cords.
8. It’s setting the variable done to True.
9. It’s printing the value of the variable swiched.
10. It’s going back to step 5.
The code will run forever, but it will only print the value of the variable swiched once.