Python Basics: Python Introduction, Setup, Hello World
Learn Python basics with beginner-friendly tutorials, examples, and exercises. Master Python programming concepts like print function, variables, comments, indentation and more. Perfect for students and professionals starting their Python journey.
Table of Contents
🔰 1. What is Python?
- Python is a high-level, interpreted general-purpose programming language.
- Known for its simple syntax and readability.
- Used in web development, data analysis, AI/ML, automation, scripting, and more.
Key Features:
- Easy to learn
- Huge standard library
- Cross-platform
- Strong community support
💻 2. Setting Up Python
Option A: Install Python (Recommended)
-
Download the latest version for your OS (Windows/macOS/Linux).
-
During installation, check the box that says "Add Python to PATH".
-
To check installation, open your terminal or command prompt and type:
python --versionOr, if that doesn't work:
python3 --version
Option B: Use Online Python Editors
📚 Learn more... 🔗 Python Tools/IDE's or Editors 🛠️
🧪 3. Your First Python Program: "Hello, World!"
Step 1: Open a code editor or terminal.
You can use:
- IDLE (Python’s built-in editor)
- VS Code
- PyCharm
- A simple text editor like Notepad
Step 2: Type the following code:
print("Hello, World!")Step 3: Save the file as hello.py
Step 4: Run the program
In terminal/command prompt:
python hello.pyIf successful, you’ll see:
Hello, World!
📘 Explanation
print()is a built-in Python function that outputs text to the screen."Hello, World!"is a string (text inside double or single quotes).
4. Comments
5. Indentation
Task : Code Together, Lead Together
Title: "Teach Your Team"
Instructions:
- Each student picks one basic Python topic (e.g., print function,Basic Printing, Printing Different Data Types, Using sep and end Parameters, Print Variables, String Formatting with f-Strings, Printing Special Characters, Syntax Error, Comments, Indentation).
- Prepare a 2-minute explanation for the group (using examples).
- Deliver their explanation to the team.
- Peers ask questions and give feedback.
💡 Key Learning Points:
✔ Leadership through teaching.
✔ Confidence in public speaking.
✔ Understanding Python better by explaining it.
References and Bibliography
- [1] “Guido van Rossum,” Wikipedia, May 24, 2021. https://en.wikipedia.org/wiki/Guido_van_Rossum
- Indentation in Python - geeksforgeeks.org
- Indentation in Python (With Examples) - askpython.com