Python Programming Basics – A Beginner’s Guide
1. Introduction Python is a high-level, interpreted programming language known for its easy-to-read
syntax and versatility. It is widely used in web development, data science, automation, and more.
2. Installing Python
Download from https://python.org
Install an IDE like PyCharm or use an online editor like Replit or Google Colab.
3. Your First Program
print("Hello, World!")
print() is used to display output.
4. Variables and Data Types
name = "Alice" # String
i = 10 # Integer
pi = 3.14 # Float
is_active = True # Boolean
5. Conditional Statements
if i > 5:
print("Greater than 5")
else:
print("5 or less")
6. Loops
For loop:
for x in range(5):
print(x)
While loop:
i=0
while i < 5:
print(i)
i += 1
7. Functions
def greet(name):
return "Hello, " + name
print(greet("Alice"))
8. Lists and Dictionaries
fruits = ["apple", "banana", "cherry"]
info = {"name": "Alice", "age": 25}
9. Error Handling
try:
result = 10 / 0
except ZeroDivisionError:
print("You can’t divide by zero!")
10. Next Steps
Learn about classes and objects.
Practice file handling and modules.
Explore libraries like NumPy, Pandas, and Flask.
End of Guide