+ 5
While loops
Hello, I'm stuck at this problem. Can somebody help? You are given a program that outputs all the numbers from 0 to 10. Change the code to make it output only the even numbers. We should use while... x = 0 while print(x) x += 1 That's what I wrote but it doesn't work x = 0 while x % 2 == 0 : print(x) x += 1
2 Antworten
0
If you use while x % 2 == 0, the loop will end when the value of x is 1.
https://code.sololearn.com/cZx1YMs86Hbc/?ref=app