Syllabus: Python Programming
1.2 Free

Variables, input and output

Storing, reading and printing values.

Variables

A variable is a named place to keep a value.

name = "Aisha"
age = 17
price = 12.5

Python works out the type for you: str, int and float here.

Input and output

input() always gives you text, so convert it when you need a number.

age = int(input("Enter your age: "))
print("Next year you will be", age + 1)

Try it yourself

Write a program that asks for two numbers and prints their average.