Python for Beginners
Your first steps into programming — no experience required
Beginner's Guide — 2024 Edition
Why Python?
Python is consistently ranked as the most popular programming language in the world
according to the TIOBE and Stack Overflow surveys. Its readable syntax reads almost like
plain English, which makes it ideal for beginners. More importantly, it is the primary language
for data science, machine learning, web development, and automation — meaning the skills
you build are directly marketable.
1. Your First Program
Install Python from [Link] (version 3.10 or above) and open a terminal. Create a file
called [Link] and type the following:
print("Hello, World!")
Run it with python [Link]. That single line sends text to the screen. Congratulations — you
are a programmer.
2. Variables and Data Types
Variables store information. Python figures out the type automatically:
name = "Maria" # string (text)
age = 28 # integer (whole number)
height = 1.65 # float (decimal)
is_student = True # boolean (True / False)
print(name, "is", age, "years old")
3. Control Flow: if / else
Programs make decisions using conditional statements:
score = 85
if score >= 90:
print("A")
elif score >= 75:
print("B")
else:
print("C")
4. Lists and Loops
A list holds multiple values. Loops let you process each one:
fruits = ["apple", "banana", "cherry"]
for fruit in fruits:
print("I like", fruit)
5. Functions: Write Once, Use Many Times
Functions package reusable logic. Define once, call anywhere:
def greet(name):
return "Hello, " + name + "!"
print(greet("Ana"))
print(greet("Carlos"))
Concept Keyword / Syntax Example
Variable name = value x = 10
Condition if / elif / else if x > 5:
Loop for / while for i in range(5):
Function def name(): def add(a, b):
Import module import import math
© 2024 — Python for Beginners | All rights reserved