Def (main) function not showing output. Process finished with exit code 0

I am viewing a video wherein the trainer runs this code as it is and get the result. I’m a newbie to python and when i replicate the same I don’t see any out. All I see in my Console is “Process finished with exit code 0”.
Could you please help me?

def main():
    name = input("Enter your name")
    print(name)

    age = input("enter your age")
    print(age)

############################
if __name__ == " __main__":
    main()

No screen shots for text please.

Copy and paste the text of your code as pre-formatted text.
You can use the </> to do this.

Cool. Thanks. Didn’t know this. Will do.

What operating system (OS) are you using?
How are you running the code you have written?

Usually you can start a terminal and run the code from the command line.
Example details depend on the OS.
On windows you can type py myprogram.py on other OS its likely you type python3 myprogram.py. Make sure you sure you are in folder where your code is.

You have a typo, remove the space in the string " __main__".

3 Likes

Yes. Thank you very much. It worked. Silly me.