Nexus Learn

Log in · Create free account

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'>
TypeMeaningExample
intWhole number21
floatNumber with a decimal point1.62
strText (in quotes)"Ayesha"
boolTrue or FalseTrue

Lines starting with # are comments. Python ignores them, so use them to explain your code.

(free account needed to save progress)

 |  Working with numbers and text →