+ 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

12th Aug 2020, 2:27 AM
Hacker Tamil Tamila
Hacker Tamil Tamila - avatar
7 Respostas
+ 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
12th Aug 2020, 2:42 AM
chaithra Gowda
chaithra Gowda - avatar
+ 3
Thanks 👍 bro
12th Aug 2020, 2:43 AM
Hacker Tamil Tamila
Hacker Tamil Tamila - avatar
+ 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
4th Oct 2020, 10:30 AM
Pratik Maity
Pratik Maity - avatar
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.
12th Aug 2020, 2:43 AM
Sâñtôsh
Sâñtôsh - avatar
0
Thanks 👍 bro
12th Aug 2020, 3:34 AM
Hacker Tamil Tamila
Hacker Tamil Tamila - avatar