Python Basics – Study Notes
Nov 17, 2026 · @Jawad
Introduction to Python
Python is a high-level, general-purpose programming language created by Guido van
Rossum in 1991. It is widely used in web development, data science, automation, and
artificial intelligence. Python is an excellent first language because its syntax is clean,
readable, and close to natural English.
Why Python?
Simple, beginner-friendly syntax
Huge standard library — no need to reinvent the wheel
Runs on Windows, macOS, and Linux
Used by companies like Google, Netflix, and NASA
How to run Python:
1. Download Python from python.org
2. Use IDLE (built-in), VS Code, or an online editor like replit.com
3. Save your file with a .py extension and run it
Variables, Data Types & Operators
A variable is a named container that stores a value. In Python you do not need to declare a
type — just assign a value.
name = "Alice" # str (text)
age = 17 # int (whole number)
gpa = 3.8 # float (decimal)
is_student = True # bool (True or False)
Core data types:
Type Example Notes
str "Hello" Text, wrapped in quotes
Page 1 of 11
, Python Basics – Study Notes
Type Example Notes
int 42 Whole numbers
float 3.14 Decimal numbers
bool True / False Logical values (capital T/F)
NoneType None Represents "no value"
Common operators:
Operator Symbol Example Result
Addition + 5 + 3 8
Subtraction - 10 - 4 6
Multiplication * 6 * 7 42
Division / 4.5
Integer division // 9 // 2 4
Modulus (remainder) % 9 % 2 1
Exponent ** 2 ** 3 8
String operators:
first = "Python"
second = " Basics"
print(first + second) # Concatenation → "Python Basics"
print(first * 3) # Repetition → "PythonPythonPython"
Type conversion:
num = int("42") # str → int
text = str(100) # int → str
decimal = float(7) # int → float
Control Flow: If Statements & Loops
Control flow lets your program make decisions and repeat actions.
Page 2 of 11