1 Basics

Data Types

Variables

1
2
3
4
a=12
b=4
c=a+b
print(c)

Inputs and Outputs

1
2
name=input("What is your name?")
print("Hello, ", name)

 

Maths Programming

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
n1=5
n2=10

c=n1 + n2
print(c)
d=n1 * n2
print(d)
e=n2 / n1
print(e)
f=n1-n2
print(f)

n3=16
n4=5

g=n3 % n4 #MOD
print(g)
h=n3 // n4 #DIV
print(h)

Data Types Quiz

Constant Variables

Constant variables are variables that usually don’t change. VAT downs’t usually change so is a constant. Notice that a constant is capitalised

Run the following program

Radius of a Circle

PI is a constant variable as it is always 3.142 to 2 decimal places