Technical Roadmap

First Python Program

let's use Python IDLE to write our first python program

1. Create a New File

Open the Python IDLE in your system. When you open it you will see the IDLE Shell window. This window is called the interactive mode, where whatever you type is executed immediately

To write a permanent program, we need to open the script mode. For that go to the top menu and select File > New File (or press Ctrl + N). A blank window will appear. This is your code editor. You can write your code here and save it for future use.

2. Write your code in the script mode

On the blank page in your editor, write the below code. This program demonstrates input and output logic by asking your name as an input and greeting you.

Python
# This is my first Python program
name = input("Enter your name: ")
print("Hello", name)
Output:
Enter your name: Riya
Hello Riya

3. Save Your Program

To run the code, Python needs to save it as a file. Go to File > Save As. Name your file hello.py and save it in a folder where you can find it later. Remember to save every Python file with the .py extension. You can also use Ctrl + S to save it.

4. Run the Code

Now, it's time to execute the code. In the window where you wrote the code, press the F5 key on your keyboard (or go to Run > Run Module).

5. Output

Your screen will switch back to the IDLE Shell. You will see the prompt: Enter your name:. Type your name and hit Enter. Python will process your input and display the personalized greeting!

Working

When you run the code, the Python Interpreter reads your script from top to bottom. It reserved a space in memory for the variable name, captured your keyboard input, and then used the print() function to send the final result to your screen.