Module 1: Python basics · 10 min
Your first program and variables
Python is a popular language for data and AI because it is easy to read. Run this one-line program to print a message:
print("Hello, Pakistan!")
A variable is a name that holds a value. Use = to store a value (it does not mean 'equals' in maths).
name = "Ayesha"
age = 21
height = 1.62
is_student = True
print(name, age)
print(type(age)) # <class 'int'>
| Type | Meaning | Example |
|---|---|---|
| int | Whole number | 21 |
| float | Number with a decimal point | 1.62 |
| str | Text (in quotes) | "Ayesha" |
| bool | True or False | True |
Lines starting with # are comments. Python ignores them, so use them to explain your code.