ZMedia Purwodadi

Python for Beginners PDF: The Complete Cheat Sheet + Where to Get Structured Learning Materials

Table of Contents

If you searched for a Python for beginners PDF, you already know what you want a structured, clear, no-fluff resource you can save, print, or read offline. Something that does not disappear when you close a browser tab.

This guide gives you exactly that. Below you will find a complete Python reference covering everything a beginner needs organised clearly so you can save this page and come back to it anytime. At the end, we will show you where to get a fully structured Python workbook built specifically for Nigerian learners who want to go beyond reading and start practising.

Python for Beginners PDF

Why Beginners Search for Python PDFs

  • Study without the internet is important in Nigeria where data is expensive
  • Print it out and study away from a screen
  • Come back to syntax quickly without scrolling through long tutorial sites
  • Have a structured path rather than jumping between random YouTube videos

1. Variables and Data Types

name = "Amina"        # String
age = 24              # Integer
gpa = 3.75            # Float
is_student = True     # Boolean

print(name)           # Amina
print(age)            # 24

2. String Operations

name = "Jacob Isah"
print(len(name))                        # 10
print(name.upper())                     # JACOB ISAH
print(name.lower())                     # jacob isah
print("Jacob" in name)                  # True
print(name.replace("Jacob", "David"))   # David Isah
print(f"My name is {name}.")

3. Numbers and Arithmetic

a, b = 100, 30
print(a + b)    # 130
print(a - b)    # 70
print(a * b)    # 3000
print(a / b)    # 3.33
print(a // b)   # 3    (floor division)
print(a % b)    # 10   (remainder)
print(a ** 2)   # 10000 (power)

4. Getting User Input

name = input("What is your name? ")
age = int(input("How old are you? "))
print(f"Hello {name}, you are {age} years old.")
print(f"In 10 years, you will be {age + 10}.")

5. If, Elif, and Else Statements

score = int(input("Enter your exam score: "))

if score >= 70:
    print("Grade A — Excellent!")
elif score >= 60:
    print("Grade B — Good job.")
elif score >= 50:
    print("Grade C — Pass.")
elif score >= 40:
    print("Grade D — Marginal pass.")
else:
    print("Grade F — You need to resit.")

6. Comparison and Logical Operators

print(10 > 5)     # True
print(10 == 10)   # True
print(10 != 5)    # True

age = 22
has_id = True

if age >= 18 and has_id:
    print("Access granted")

7. For Loops

for i in range(1, 6):
    print(f"Number: {i}")

states = ["Lagos", "Abuja", "Kano", "Enugu"]
for index, state in enumerate(states):
    print(f"{index + 1}. {state}")

8. While Loops

count = 1
while count <= 5:
    print(f"Count: {count}")
    count += 1

9. Lists

students = ["Kemi", "Tunde", "Fatima", "Chidi"]
print(students[0])      # Kemi
print(students[-1])     # Chidi
students.append("Ngozi")
students.remove("Tunde")
print(len(students))

10. Dictionaries

student = {"name": "Blessing", "age": 21, "score": 78}
print(student["name"])
student["course"] = "Data Analysis"
for key, value in student.items():
    print(f"{key}: {value}")

11. Functions

def greet(name):
    return f"Welcome, {name}!"

print(greet("Adaeze"))

def calculate_total(price, quantity, discount=0):
    return (price * quantity) - discount

print(calculate_total(2500, 3, 500))   # 7000

12. List Comprehensions

squares = [i ** 2 for i in range(1, 6)]
print(squares)   # [1, 4, 9, 16, 25]

evens = [i for i in range(1, 21) if i % 2 == 0]
print(evens)

13. File Handling

with open("students.txt", "w") as file:
    file.write("Amina\nTunde\nNgozi\n")

with open("students.txt", "r") as file:
    for line in file:
        print(line.strip())

14. Error Handling

try:
    number = int(input("Enter a number: "))
    result = 100 / number
    print(f"Result: {result}")
except ValueError:
    print("Invalid input. Enter digits only.")
except ZeroDivisionError:
    print("Cannot divide by zero.")
finally:
    print("Done.")

Python Quick Reference Cheat Sheet

# VARIABLES
name = "Jacob"   # string
age = 25         # integer
gpa = 3.8        # float
active = True    # boolean

# CONDITIONALS
if x > 10: pass
elif x == 10: pass
else: pass

# LOOPS
for i in range(5): pass
for item in my_list: pass
while condition: pass

# LISTS
lst = [1, 2, 3]
lst.append(4); lst.remove(2); len(lst)

# DICTIONARIES
d = {"key": "value"}
d["new"] = "val"; d.get("key")

# FUNCTIONS
def func(p1, p2="default"):
    return p1 + p2

# FILES
with open("file.txt", "r") as f:
    content = f.read()

# ERRORS
try:
    risky_code()
except ExceptionType:
    handle_error()

What to Learn After the Basics

  • Data Analysis: Pandas, NumPy, and Matplotlib
  • Web Development: Django or FastAPI
  • Machine Learning: Scikit-learn
  • Automation: Web scraping, file automation, and scheduled tasks

Why Reading Alone Is Not Enough

Reading gives you awareness. Practice gives you skill. You can read this entire page, understand every concept, and still not be able to write a working Python program from scratch tomorrow. Programming is a muscle you build it by doing, not by reading.

The Python Exercises Workbook from JacobIsah Programming Hub contains 100+ hands-on exercises covering every topic in this guide variables, strings, loops, functions, lists, dictionaries, file handling, and more. Every exercise includes a full solution so you can check your work, learn from your mistakes, and keep moving forward.

This is the structured Python resource you were looking for when you searched for a PDF.

Get the Python Exercises Workbook at jacobisah.selar.com

Ready to go further? Our Data Analysis with Python Course takes you from beginner to job-ready analyst with Nigerian datasets, real projects, and step-by-step guidance.

Explore all courses at jacobisah.selar.com

Your Python Learning Roadmap

  1. Install Python from python.org and VS Code from code.visualstudio.com
  2. Learn the fundamentals variables, conditionals, loops, functions, lists, dictionaries
  3. Practice daily build small programs, solve exercises, do not just read
  4. Pick a direction data analysis, web development, or automation
  5. Build a real project grade calculator, budget tracker, or quiz app
  6. Get structured help a workbook or course gives you a proven learning path

Visit jacobisah.selar.com for structured exercises, courses, and resources built for Nigerian Python learners.

Jacob Isah | JacobIsah Programming Hub | Osogbo, Nigeria
From Beginner to Builder, one line of code at a time.

Post a Comment