-
Hajipur, Bihar, 844101
To write and run Python programs, you need a Python editor or IDE (Integrated Development Environment). Two commonly used tools for this are:
Python IDLE – Comes built-in with Python.
Visual Studio Code (VS Code) – A powerful and customizable editor from Microsoft.
Let’s explore both and understand how to set them up.
IDLE (Integrated Development and Learning Environment) is the default editor that comes with Python installation.
Install Python from python.org
Open IDLE:
On Windows: Search for "IDLE"
On macOS/Linux: Run idle
in terminal
Comes with a Python shell (interactive interpreter)
File editor with syntax highlighting
Easy to test and run code quickly
Good for beginners
Open IDLE
Click File > New File
Write your code, e.g.:
print("Hello from IDLE!")
Save the file (e.g., hello.py
)
Press F5 or go to Run > Run Module
VS Code is a lightweight and extensible code editor developed by Microsoft. It supports Python through an extension.
Download and install VS Code
Open VS Code and go to Extensions (Ctrl+Shift+X
)
Search and install "Python" extension by Microsoft
Install Python from python.org
Create a new .py
file and start writing code:
print("Hello from VS Code!")
Open a terminal in VS Code: `Ctrl+```
Run the script:
python filename.py
Syntax highlighting
IntelliSense (smart code suggestions)
Debugging support
Git integration
Works with many languages
Feature | IDLE | VS Code |
---|---|---|
Built-in with Python | ✅ Yes | ❌ No (needs install) |
Beginner Friendly | ✅ Very Easy | ⚠️ Slight learning curve |
Extensions/Add-ons | ❌ No | ✅ Yes (many) |
Debugging Tools | Basic | Advanced |
Recommended For | Beginners | Intermediate & Advanced |
Q1. Write a Python program to print your name.
Q2. Write and run a program that adds two numbers.
Q3. Create a program that prints today’s date.
Q4. Write a program to calculate area of a rectangle.
Q5. Use input() to take user’s name and print a greeting.
Q6.Write a program that calculates square of a number.
Q7. Write and run a script to reverse a string.
Q8. Create a Python file that checks if a number is even or odd.
Q9. Write a script that prints numbers from 1 to 10.
Q10. Create and run a program to convert Celsius to Fahrenheit.
Q1: What is IDLE in Python?
Q2: Which of these is used to install extensions in VS Code?
Q3: Shortcut key to run a Python program in IDLE?
Q4: Which of these supports Python debugging with breakpoints?
Q5: VS Code is developed by:
Q6: What is the default file extension for Python?
Q7: Which command runs Python code in terminal?
Q8: In IDLE, the interactive shell shows output immediately after:
Q9: VS Code allows code formatting using:
Q10: Which one is better for large projects?