Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Python Programming Basics

Rating
-
Sold
-
Pages
6
Uploaded on
27-03-2026
Written in
2025/2026

Python Programming — Complete Study Notes | Beginner to Intermediate Colour-coded, exam-ready Python notes covering 8 essential topics: Variables & Data Types • Control Flow • Functions • OOP • Lists & Dictionaries • File I/O • Exam Cheat Sheet Comparison tables & exam tips Perfect for CS students & coding beginners Download once. Study smarter. Score higher.

Show more Read less
Institution
Course

Content preview

🐍 Python Programming — Complete Study Notes | Page




🐍
PYTHON PROGRAMMING
Complete Study Notes | Beginner to Intermediate
Variables • Functions • OOP • Libraries • File I/O • Exam Tips




📚 8 Topics 💡 30+ Examples ⚡ Key Tips 📝 Exam Ready



1. INTRODUCTION TO PYTHON

Python is a high-level, interpreted, general-purpose programming language. Created by Guido van
Rossum in 1991, it emphasises code readability and simplicity, making it the world's most popular
language for beginners and professionals alike.
Why Python?
● Simple, English-like syntax — easy to learn and write
● Interpreted — runs line by line; no compilation needed
● Cross-platform — runs on Windows, macOS, Linux
● Huge standard library + thousands of packages (pip)
● Used in Web Dev, AI/ML, Data Science, Automation, Cloud & IoT



2. VARIABLES & DATA TYPES

A variable is a named container that stores data. In Python, you do NOT declare types — Python infers
them automatically (dynamic typing).
Data Type Example Description
int age = 25 Whole numbers (no decimals)
float gpa = 3.75 Decimal / real numbers
str name = "Alice" Text (sequence of characters)
bool passed = True True or False only
list marks = Ordered, mutable collection
[90,85,78]

dict info = Key-value pairs (hash map)
{"key":"val"}

tuple coords = (10, 20) Ordered, immutable collection



© CS Study Hub | Python Programming Notes | Share & Learn — Not for Resale

, 🐍 Python Programming — Complete Study Notes | Page

set ids = {1, 2, 3} Unique unordered elements


Variable Examples:
# Assigning variables
name = "Alice" # string
age = 20 # integer
gpa = 3.85 # float
is_enrolled = True # boolean

# Type checking
print(type(name)) # <class 'str'>
print(type(age)) # <class 'int'>

# Multiple assignment
x, y, z = 10, 20, 30




💡 PRO TIP — Naming Conventions
Use snake_case for variables (my_variable), PascalCase for classes (MyClass). Variable names
are case-sensitive: age ≠ Age ≠ AGE. Avoid using Python reserved keywords like list, print, or input
as variable names.



3. CONTROL FLOW — if / elif / else & Loops

3.1 Conditional Statements
Python uses indentation (4 spaces) instead of curly braces to define code blocks.

score = 75

if score >= 90:
print("A — Distinction")
elif score >= 75:
print("B — Merit") # This runs
elif score >= 60:
print("C — Pass")
else:
print("F — Fail")



3.2 Loops
for Loop while Loop
Used when you know how many times to repeat. Used when condition decides when to stop.
for i in range(5): count = 0
print(i) # 0,1,2,3,4 while count < 5:
print(count)
fruits = ['apple','mango'] count += 1
for f in fruits:
print(f) # break exits loop early

© CS Study Hub | Python Programming Notes | Share & Learn — Not for Resale

Written for

Institution
Course

Document information

Uploaded on
March 27, 2026
Number of pages
6
Written in
2025/2026
Type
Class notes
Professor(s)
E mlambe
Contains
All classes

Subjects

$5.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
mitchellmudziviri

Get to know the seller

Seller avatar
mitchellmudziviri University of Zimbabwe
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 month
Number of followers
0
Documents
2
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions