+ 3
x = 1 while x < 10: if x%2 == 0: print(str(x) + " is even") else: print(str(x) + " is odd") elif:
Brother and sister help this programming error
6 odpowiedzi
+ 11
Between the error was u didn't increment the loop so it was continuously showing for the initial value and elif won't come after else
https://code.sololearn.com/crerg4Cgy9R0/?ref=app
+ 3
Thanks 👍 bro
+ 1
x = 1
while x < 10:
if x%2 == 0:
print(str(x) + " is even")
else:
print(str(x) + " is odd")
x += 1
x%2 == 0: explain this line please
0
x = int(input())
while x < 10:
if x%2 == 0:
print(str(x) + " is even")
break
else:
print(str(x) + " is odd")
break
See above code and don't use last line.
0
Thanks 👍 bro