Transcript Arrays
1.
2.
3.
Know what a variable is, and why they are
fundamental in programming.
Know the different uses of variables
Understand how you can add data and read
data from a variable.
The best way to think of a variable is an
empty box
The box is able to store something, but if
you want to add something new, then item
that’s in there will be lost.
All variables will have a name given to them
by the programmer.
Put stuff in here
In programming there are 4 main types of
variables.
String
Integer
Boolean
Double
“Some text”
37
True or False
3.45
How to declare a variable
Variables must follow these
rules in Python
Declaring
Initialising
Must begin with a letter (a z, A - B) or underscore (_)
Other characters can be
letters, numbers or _
Case Sensitive
Can be any (reasonable)
length
There are some reserved
words which you cannot use
as a variable name because
Python uses them for other
things
Computers were invented to complete really
difficult maths
This means that they are great for doing maths
Type
Mathematical notation
Python Notation
Adding
2+2
2+2
Subtracting
9-4
9-4
Multiplication
2x9
2*9
Division
8÷2
8/2
A program that doesn’t allow input of data, is
useless
You need to be able to take information in,
process it and then output the information
Allow a user to enter a number of miles.
Display the same distance in kilometres.
Allow a user to enter a number of kilometres.
Display the same distance in miles.
Also convert into Furlongs!
Conversions
Miles to Kilometer – 1 miles to 1.6 Kilometers
Miles to Furlongs – You need to find this out