🐍 Python for Starters

Your journey to becoming a programmer starts here.

Welcome!

Python is one of the most popular, beginner-friendly programming languages in the world. It’s used for web development, data science, AI, and simple automation.

1 Installation

Before writing code, you need Python installed on your computer:

2 Your First Program

The traditional start is the "Hello World" program. It simply displays text on the screen.

# This is a comment - Python ignores this
print("Hello, World!")
print("I am learning Python!")

3 Variables & Data Types

Variables store information. In Python, you don't need to declare the type; it figures it out automatically.

# String (text)
name = "Alice"

# Integer (whole numbers)
age = 25

# Float (decimal numbers)
height = 5.9

# Boolean (True or False)
is_student = True

print(name, "is", age, "years old.")

4 Making Decisions (If/Else)

Use if statements to let your program make decisions based on conditions.

score = 85

if score >= 90:
    print("Grade: A")
elif score >= 80:
    print("Grade: B")
else:
    print("Keep practicing!")

5 Loops

Loops allow you to repeat a block of code multiple times.

# A 'for' loop to count to 5
print("Counting...")
for i in range(1, 6):
    print(i)

# A 'while' loop
count = 0
while count < 3:
    print("Looping...")
    count += 1

6 Functions

Functions are reusable blocks of code that perform a specific task.

def greet(person_name):
    return "Hello, " + person_name + "!"

# Calling the function
message = greet("Developer")
print(message)