Python Programming Basics – A Complete Beginner Guide
Table of Contents
- 1. Introduction to Python
- 2. Installing Python
- 3. Your First Python Program
- 4. Python Syntax Basics
- 5. Variables and Data Types
- 6. Input and Output
- 7. Operators
- 8. Conditional Statements
- 9. Loops
- 10. Functions
- 18. Conclusion
1. Introduction to Python
Python is a high-level, interpreted, and beginner-friendly programming language. It is widely used for web development, data science, artificial intelligence, automation, game development, and more.
Why Learn Python?
- Easy to read and write
- Large community support
- Huge collection of libraries and frameworks
- Works on Windows, macOS, and Linux
2. Installing Python
Step 1: Download Python
- Visit the official Python website
- Download the latest stable version (Python 3.x)
Step 2: Install Python
- Check “Add Python to PATH”
- Complete the installation
Step 3: Verify Installation
python --version
3. Your First Python Program
print("Hello, World!")
python hello.py
4. Python Syntax Basics
Comments
# This is a comment
Indentation
if 5 > 2:
print("Five is greater than two")
5. Variables and Data Types
name = "Alice"
age = 25
height = 5.6
is_student = True
int– Integer numbersfloat– Decimal numbersstr– Textbool– True or False
6. Input and Output
name = input("Enter your name: ")
print("Hello", name)
7. Operators
a = 10
b = 3
print(a + b)
print(a - b)
print(a * b)
print(a / b)
8. Conditional Statements
age = 18
if age >= 18:
print("You are eligible to vote")
else:
print("You are not eligible")
9. Loops
for i in range(5):
print(i)
count = 0
while count < 5:
print(count)
count += 1
10. Functions
def greet(name):
return "Hello " + name
print(greet("Alice"))
18. Conclusion
Python is an excellent language for beginners and professionals alike. Practice regularly and build projects to master Python.
Happy Coding with Python! 🐍