Python Notes
Master Python IDLE – Python
Hindi: Python IDLE Python ke saath aata hai ek free, built-in IDE (Integrated Development Environment) hai. Agar aap abhi Python seekhna start kar rahe hain, toh IDLE ek achha starting point hai – koi extra software install karne ki zaroorat nahi!
🖥️ What is Python IDLE?
IDLE stands for Integrated Development and Learning Environment. It is Python's built-in IDE that comes automatically when you install Python. It was created by Guido van Rossum (Python's creator) himself.
Hindi: IDLE ka full form hai Integrated Development and Learning Environment. Yeh Python ke saath automatically install ho jaata hai – koi extra install karne ki zaroorat nahi. Iska naam ek joke bhi hai – "IDLE" se "Monty Python" ke ek member ka naam "Eric Idle" yaad aata hai!
| │ Full Name | Integrated Development and Learning Env. │ |
| │ Creator | Guido van Rossum │ |
| │ Built with | Python (Tkinter GUI) │ |
| │ License | Included with Python (free) │ |
| │ Best for | Learning Python, quick testing │ |
| │ NOT best | Large projects, team collaboration │ |
IDLE Has Two Modes:
| Shell Mode | Script Mode | |||
|---|---|---|---|---|
| (Interactive) | (Editor) | |||
| >>> print(2+2) | # my_program.py | |||
| 4 | name = "Python" | |||
| >>> | print(name) | |||
| Type code and | Write full program, | |||
| see result | save and run it | |||
| immediately |
⚖️ IDLE vs Other Editors
Hindi: IDLE kaafi simple hai, par kuch specific situations mein it's perfect. Dekhte hain kab IDLE use karein aur kab nahi.
| Feature | IDLE | VS Code | PyCharm |
|---|---|---|---|
| Installation | Auto (with Python) | Separate | Separate |
| Size | Very small | Medium (~100MB) | Large (~500MB) |
| Complexity | Simple | Medium | Complex |
| Best for | Learning basics | All projects | Professional |
| Extensions | None | 50,000+ | Many |
| Debugger | Basic | Advanced | Advanced |
| Git support | None | Built-in | Built-in |
| Performance | Very fast | Fast | Slower |
| Mobile | No | Via web | No |
When to Use IDLE:
- ✅ Just starting to learn Python
- ✅ Quick experiments and testing
- ✅ No internet to download another editor
- ✅ School/exam environment (often only IDLE available)
- ✅ Simple scripts and calculations
When NOT to Use IDLE:
- ❌ Large projects with many files
- ❌ Team collaboration
- ❌ Web development
- ❌ Data science with Jupyter notebooks
- ❌ When you need Git integration
🚪 How to Open IDLE
Hindi: IDLE kholne ke kai tarike hain – platform ke hisaab se.
Windows
Method 1: Start Menu
Method 2: Python Launcher
Method 3: Command Line
# Open IDLE from command prompt
idle
# or
python -m idlelib
# or
python -m idlelib.idleMethod 4: From File Explorer
macOS
Method 1: Applications → Python → IDLE
Method 2: Terminal
idle3
# or
python3 -m idlelibLinux
# Install if not present
sudo apt install idle3 # Ubuntu/Debian
sudo dnf install idle3 # Fedora
# Open
idle3🐚 IDLE Shell – Interactive Mode
When IDLE opens, you see the Shell window first. This is the interactive mode or REPL (Read-Eval-Print Loop).
The >>> Prompt
The >>> is called the prompt. It means Python is waiting for your input.
Hindi: >>> ka matlab hai Python aapka input wait kar raha hai. Yahan directly code type karein aur Enter dabaayen – result turant dikhega!Basic Shell Interactions:
>>> print("Hello, World!")Hello, World!
>>> 10 + 2030
>>> 2 ** 101024
>>> name = "Python"
>>> print(f"I love {name}!")I love Python!
>>> type(42)<class 'int'>
>>> type("hello")<class 'str'>
>>> len("Python")6
[1, 2, 3, 4, 5]
60
Multi-line Code in Shell:
When you type a statement that needs more lines (like a loop or function), IDLE shows ...:
>>> for i in range(5):
... print(f"Number: {i}")
...Number: 0 Number: 1 Number: 2 Number: 3 Number: 4
>>> def greet(name):
... return f"Hello, {name}!"
...
>>> greet("India")'Hello, India!'
Hindi: ... ka matlab hai ki Python abhi aur code expect kar raha hai. Enter press karne par code run hoga.Useful Shell Features:
# Previous command – press Up Arrow key
# This recalls your last typed command
# Clear shell output
>>> # Press Ctrl+L or go to Shell menu → Restart Shell
# Help on any function
>>> help(print)
# Shows complete documentation for print()
# dir() – list all attributes of an object
>>> dir(str)
# Shows all string methods
>>> dir([])
# Shows all list methods📝 IDLE Script Editor
The Script Editor is where you write full Python programs, save them as .py files, and run them.
Open a New Script File:
| 1 | |
|---|---|
| 2 | |
| 3 |
Write a Program:
# greeting_program.py
# A simple greeting program
print("=" * 40)
print(" PYTHON GREETING PROGRAM")
print("=" * 40)
name = input("Enter your name: ")
age = int(input("Enter your age: "))
greeting = f"Hello, {name}!"
message = f"You are {age} years old."
print("\n" + greeting)
print(message)
if age < 18:
print("You are a minor.")
elif age < 60:
print("You are an adult.")
else:
print("You are a senior citizen.")
print("\nThank you for using Python IDLE!")Save the File:
| Method 1 | Ctrl + S |
| Method 2: File | Save |
| Method 3: File | Save As (to save with a new name) |
Hindi: File save karte waqt.pyextension use karein, jaisemera_program.py. File naam mein spaces mat use karein – underscore use karein.
Run the Script:
| Method 1 | Press F5 |
| Method 2: Run | Run Module |
| Method 3: Run menu | Run Customized... (to pass arguments) |
========================================
PYTHON GREETING PROGRAM
========================================
Enter your name: Rahul
Enter your age: 25
Hello, Rahul!
You are 25 years old.
You are an adult.
Thank you for using Python IDLE!✨ IDLE Editing Features
Hindi: IDLE mein kuch smart editing features hain jo coding aasaan banate hain.
1. Syntax Highlighting
IDLE automatically colors different parts of your code:
| │ Keywords | Orange/Purple (if, for, def, class) │ |
| │ Strings | Green ("hello", 'world') │ |
| │ Comments | Red (# this is comment) │ |
| │ Built-ins | Purple (print, len, range) │ |
| │ Numbers | Black (42, 3.14) │ |
| │ Regular code | Black (variables, ops) │ |
| │ Shell output | Blue (results) │ |
| │ Shell errors | Red (error messages) │ |
2. Auto-Indentation
After a : (colon), IDLE automatically indents the next line:
def my_function():
# IDLE auto-indented this line! ↵ after colon
pass
for i in range(10):
# Auto-indented too!
print(i)Hindi: Colon ke baad IDLE automatically indent kar deta hai – aapko Tab manually dabane ki zaroorat nahi.
3. Bracket Completion
IDLE automatically completes brackets:
4. Code Completion (Tab Completion)
Press Tab to see suggestions:
>>> import os
>>> os.path. # Press Tab here
# Shows: abspath basename commonpath dirname exists ...5. Find and Replace
| Edit | Find... (Ctrl+F) |
| Edit | Replace... (Ctrl+H) |
| Edit | Find Again (Ctrl+G) |
6. Go to Line
7. Indent / Dedent
🐛 IDLE Debugger
Hindi: IDLE ka built-in debugger aapko code step-by-step run karke dekh ne deta hai ki kahan problem aa rahi hai.
Enable the Debugger:
| │ Stack | │ |
| │ > __main__.<module>(), line 5 | name = input("Enter name: ")│ |
| │ Locals | │ |
| │ __builtins__ | <module 'builtins' ...> │ |
| │ __doc__ | None │ |
| │ __name__ | '__main__' │ |
Debug Controls:
| Button | Action | Shortcut |
|---|---|---|
| Go | Run until breakpoint or end | - |
| Step | Execute one line (enters functions) | - |
| Over | Execute one line (skips functions) | - |
| Out | Run until current function returns | - |
| Quit | Stop debugging | - |
Setting Breakpoints:
Debug Example:
# debug_demo.py
def add_numbers(a, b):
result = a + b # ← Set breakpoint on this line
return result
x = 10
y = 20
total = add_numbers(x, y)
print(f"Total: {total}")Hindi: Debugger bahut useful hai jab program ka output expected nahi hota. Step by step chala kar dekh sakte hain ki kahan galti ho rahi hai.
🎨 Customizing IDLE
Hindi: IDLE ka default look change kar sakte hain – font, colors, theme sab customize ho sakta hai.
Open Settings:
Fonts & Tabs Tab:
| │ Font Face | [Consolas ▼] │ |
| │ Size | [ 12 ▼] │ |
| │ Indentation Width | [4 ▼] ← PEP8 standard │ |
Highlights (Colors/Theme) Tab:
Built-in themes
- IDLE Classic (default, light)
- IDLE Dark ← Popular choice
- IDLE New
Custom theme
- Create your own color scheme
- Choose color for each element type
Recommended IDLE Dark Theme Settings:
| Theme | IDLE Dark |
| Normal text | White (#ffffff) |
| Python keywords | Orange (#ff7f50) |
| Built-in functions | Cyan (#00ffff) |
| Strings | Green (#90ee90) |
| Comments | Gray (#808080) |
| Shell output | Light blue (#add8e6) |
| Error text | Red (#ff6b6b) |
Hindi: IDLE Dark theme aankhon ke liye comfortable hai – khaskar raat ko coding karte waqt. Options → Configure IDLE → Highlights mein "IDLE Dark" select karein.
Keys Tab (Custom Shortcuts):
⌨️ IDLE Keyboard Shortcuts
Hindi: Yeh shortcuts yaad karne se IDLE mein coding bahut fast ho jaati hai.
Shell Shortcuts:
| Action | Shortcut |
|---|---|
| Previous command | Alt+P or Up Arrow |
| Next command | Alt+N or Down Arrow |
| Move to beginning of line | Home or Ctrl+A |
| Move to end of line | End or Ctrl+E |
| Clear to end of line | Ctrl+K |
| Restart shell | Ctrl+F6 |
| Interrupt running program | Ctrl+C |
| Tab completion | Tab |
Editor Shortcuts:
| Action | Shortcut |
|---|---|
| Run module | F5 |
| New file | Ctrl+N |
| Open file | Ctrl+O |
| Save file | Ctrl+S |
| Save As | Ctrl+Shift+S |
| Find | Ctrl+F |
| Find again | Ctrl+G |
| Replace | Ctrl+H |
| Go to line | Alt+G |
| Indent | Ctrl+] |
| Dedent | Ctrl+[ |
| Toggle comment | Alt+3 (add) / Alt+4 (remove) |
| Select all | Ctrl+A |
| Copy | Ctrl+C |
| Paste | Ctrl+V |
| Undo | Ctrl+Z |
| Redo | Ctrl+Y |
| Close window | Alt+F4 |
| Show calltip | Ctrl+\ |
| Autocomplete | Tab |
💡 IDLE Tips and Tricks
Tip 1: Use Shell as a Calculator
>>> import math
>>> math.sqrt(144)12.0
>>> math.factorial(10)3628800
>>> 1000 * 365 * 24 * 60 * 60 # Seconds in 1000 years31536000000
Hindi: IDLE Shell ek powerful calculator ki tarah use kar sakte hain – koi bhi math calculation seedha type karke result dekh sakte hain.
Tip 2: Test Code Before Adding to Script
# Test logic in shell first
>>> words = "Hello Python World"
>>> words.split()['Hello', 'Python', 'World']
>>> words.upper()'HELLO PYTHON WORLD'
# Once you know it works, add to your script!Tip 3: Use help() for Documentation
>>> help(str.split)Help on method_descriptor:
split(self, /, sep=None, maxsplit=-1)
Return a list of the words in the string, using sep as the delimiter string.
sep
The delimiter according which to split the string.
None (the default value) means split according to any whitespace,
and discard empty strings from the result.
maxsplit
Maximum number of splits to do.
-1 (the default value) means no limit.Tip 4: Recent Files
Tip 5: Multiple Windows
You can have multiple IDLE windows open simultaneously – one Shell and multiple editor windows.
🔧 Troubleshooting IDLE
❌ Problem 1: IDLE won't open
Hindi: IDLE open nahi ho raha – yeh problems ho sakti hain.
Fix:
# Method 1: Run from terminal
python -m idlelib
# Method 2: Check Python installation
python --version
# Method 3: Reinstall Python with IDLE
# During Python installer, make sure "tcl/tk and IDLE" is checked
# Method 4: Windows - run as Administrator
# Right-click IDLE → Run as Administrator❌ Problem 2: IDLE crashes when running program
Cause: Infinite loop or consuming too much memory.
Fix:
❌ Problem 3: "No module named tkinter"
Fix (Linux):
sudo apt install python3-tk # Ubuntu/Debian
sudo dnf install python3-tkinter # FedoraFix (macOS):
brew install python-tk@3.13Hindi: IDLE Tkinter module par depend karta hai. Linux mein python3-tk install karna padta hai.❌ Problem 4: Cannot type in IDLE Shell
Cause: Program is still running (loop or waiting for input).
Fix:
❌ Problem 5: IndentationError in IDLE
Fix:
# Wrong - no indentation after if:
if True:
print("Hello") # ← Error here
# Correct - 4 spaces indentation:
if True:
print("Hello") # ← 4 spaces before printHindi: Python mein indentation (spaces) bahut important hai. IDLE Tab dabane par 4 spaces insert karta hai – yahi sahi hai.
❌ Problem 6: File won't save / Permission Error
Fix:
❌ Problem 7: IDLE is very slow
Fix:
🆚 IDLE vs VS Code – When to Use What
Hindi: Dono tools ke apne fayde hain. Yahan decide karna aasaan ho jaata hai ki kab kaunsa use karein.
| ✅ Learning Python fundamentals (first few weeks) | ||
|---|---|---|
| ✅ Quick one-file experiments | ||
| ✅ Testing a small function or formula | ||
| ✅ School/exam environment | ||
| ✅ No internet / minimal setup needed | ||
| ✅ Building real projects (multiple files) | ||
| ✅ Using virtual environments | ||
| ✅ Web development, data science, ML | ||
| ✅ Collaborating with others (Git) | ||
| ✅ Professional development work |
📊 IDLE Architecture
Hindi: IDLE ek GUI application hai jo Tkinter se bana hai. Yeh Python interpreter ko ek separate subprocess mein chalata hai, isliye IDLE crash hone par bhi interpreter safe rehta hai.
🧪 Practice Exercises in IDLE
Hindi: Yeh exercises IDLE mein karke practice karein.
Exercise 1: Shell Calculator
>>> # Calculate area of a circle with radius 7
>>> import math
>>> radius = 7
>>> area = math.pi * radius ** 2
>>> print(f"Area of circle: {area:.2f}")Area of circle: 153.94
Exercise 2: Write a Script
# Create a new file: calculator.py
# Simple calculator program
print("Simple Calculator")
print("-" * 20)
num1 = float(input("Enter first number: "))
operator = input("Enter operator (+, -, *, /): ")
num2 = float(input("Enter second number: "))
if operator == "+":
result = num1 + num2
elif operator == "-":
result = num1 - num2
elif operator == "*":
result = num1 * num2
elif operator == "/":
if num2 != 0:
result = num1 / num2
else:
print("Error: Division by zero!")
result = None
else:
print("Error: Invalid operator!")
result = None
if result is not None:
print(f"\nResult: {num1} {operator} {num2} = {result}")Simple Calculator -------------------- Enter first number: 25 Enter operator (+, -, *, /): * Enter second number: 4 Result: 25.0 * 4.0 = 100.0
Hindi: Yeh calculator program IDLE mein likhein aur run karein. Input() function user se input leta hai aur if/elif conditions se calculation hota hai.
🚀 Summary
IDLE is a great starting point for Python learners.
Hindi: IDLE Python ke saath aata hai – bilkul free. Beginners ke liye Shell mode aur Script Editor dono bahut useful hain. Kuch din IDLE mein practice karke VS Code par shift ho jaayein.
Next Steps:
| Step | Topic | File |
|---|---|---|
| ← Previous | Install VS Code | install-vscode.mdx |
| → Next | First Python Program | first-python-program.mdx |
| → Later | Environment Setup | python-environment-setup.mdx |
*Last Updated: June 12, 2026 | Author: WohoTech | Category: Python Setup*
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Python IDLE – Complete Guide for Beginners 2026.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Python Master Course topic.
Search Terms
python-master-course, python master course, python, master, course, setup, idle, python idle – complete guide for beginners 2026
Related Python Master Course Topics