0

i am not getting correct even odd numbers count from given range of numbers (range -5 to 7)...

a = int(input()) b = int(input()) even_count = 0 odd_count = 0 for i in range(a, b+1): if (i%2) == 0: even_count = even_count +1 else: odd_count = odd_count + 1 print(even_count) print(odd_count)

23rd Feb 2021, 9:58 AM
anil jampani
anil jampani - avatar
3 Réponses
+ 5
anil jampani Please don't paste your code in the tags. Rather just put Python as the language name relevant to the question.
23rd Feb 2021, 10:40 AM
Ipang
+ 2
Hi! I have your program outputs two numbers 6 and 7. I don't see any errors. what is the wrong calculation?
23rd Feb 2021, 10:09 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
it was certainly not very convenient, but I inserted this code in the code playground section and got the result
23rd Feb 2021, 10:42 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar