Technical Roadmap

First Python Program

Let's write and run our first Python program using Python IDLE. Follow these simple steps to move from a blank screen to a working script.

  • Open Python IDLE:
    Interactive Mode: The Shell runs code instantly (best for quick tests) Script Mode: Go to File > New File or press Ctrl + N
  • Write the Code:
    Open a new blank file (Script Mode) Type: name = input("Enter your name: ") Type: print("Hello", name)
  • Save and Run:
    Click File > Save As and name it hello.py Always use the .py extension Press F5 or click Run > Run Module to execute
  • Check the Output:
    The screen will switch back to the IDLE Shell Enter your name when prompted and press Enter • You will see the greeting message processed by Python
    PYTHON
    # My first Python Program
    name=input("Enter your name: ")
    print("Hello",name)
    

    Output

    Enter your name: Riya
    Hello Riya

Related Articles