Why is infinite inputting of a variable happening in Python?

Question:

num = int(input())
evenCounter = 0
while num != 0:
    if num % 2 == 0:
        evenCounter += 1

print(evenCounter)

Maybe this is sort of silly question, but I really can’t figure out why does inifite input of the variable happen here. The console just keep asking me to write in a number for some reason.

Asked By: Coder4Fun250

||

Answers:

I guess you get it wrong, it asks user input just once, and then it’s stuck in a while loop, and you think that it’s asking user anther input. To check it just add some text in input('add some text here: ' ) and you’ll see that input is called just once.

Answered By: Dmitriy Neledva