If else statement issue in Visual studio code

I just started python, and wrote this simple code in Visual Studio Code editor -

What should I do now?? How can I resolve it?

Okay, and exactly what steps did you take, after writing it, in order to try using it? Where do you click, what keyboard shortcuts do you use/menu items do you select, what do you type?

Please don’t post screenshots of text. It is better to past the text inline between triple backticks. The compose bar has a </> button to make these for you. That way we can copy/paste the text ourselves.

That said, looking at the output:

it seems to me that right after typing a “4” at your prompt you somehow pasted a big chunk of text from above before pressing . Is this the case? If so, retry, but just enter the 4.

The int() constructor/function requires its input value to be a clean integer string with no other characters.

I’m just throwing a wild guess: did you type in the number before pressing the “run” button? (Don’t do that.) I can’t reproduce the behavior, maybe because I’m not on windows, but the error message looks like that’s what happened. It’s a quirk of vscode that you can do that, but usually it’s a bad idea.

1 Like