Variables are containers for storing data values.
Types¶
There are a few main types you’ll use often:
Integers:
These are whole numbers without decimals
Some examples:
0,-7,4915,-2910
Floats
These are numbers that include decimals
Some examples:
-7.1,16.53,49.15, ``
String
A string is a string of text
Some examples:
"Spartronics is the best","Chill chill chill out out out"
Boolean
A boolean can be either
TrueorFalse
Defining a variable¶
It’s super easy to define a variable. Do so with the following format:
name = value
You do not need to say what type of variable it is. Python will figure that out for you. You can even change the type of a variable later on.
Try defining a string called team with the value "Spartronics"
Changing the value of a variable¶
To change a value of a variable, you just redefine it