Ways to Execute Python Programs
Ways to Execute Python Programs
Python programs ko run karne ke
multiple tareeke
hote hain.
Use case ke hisaab se suitable method choose kiya jata hai.
1. Interactive Mode
Interactive Mode me Python code line-by-line execute hota hai aur output turant milta hai.
- Is mode ko Python Shell bhi kaha jata hai
- >> prompt se pehchana jata hai
Use:
- Python basics seekhne ke liye
- Small calculations
- Quick testing
Example:
>>> print("Hello")
Hello
>>> 5 + 3
8
2. Script / Batch Mode
Script Mode me poora Python program ek file me likha jata hai aur ek saath execute hota hai.
- File extension: .py
- Program Command Prompt se run hota hai
Use:
- Real programs
- Long scripts
- Software development
Example:
# file: hello.py
print("Hello World")
Command:
python hello.py
3. Using IDE (Integrated Development Environment)
IDE ek advanced tool hota hai jo code likhne, run karne aur debug karne me help karta hai.
Features:
- Syntax highlighting
- Error detection
- Run button
- Debugging support
Common IDEs:
- VS Code
- PyCharm
- Thonny
Use:
- Large projects
- Professional development
4. Jupyter Notebook
Jupyter Notebook ek browser-based environment hota hai jisme code aur explanation ek saath likhe ja sakte hain.
Features:
- Code cell-by-cell execute hota hai
- Text, images aur graphs add kar sakte hain
Use:
- Data Science
- Machine Learning
- Teaching and Research