Level I
Play with variables
Variables are containers that store the values that you choose (only if you have created it, obviously). A variable is created at the moment you assign a value to it. Your variables can have any name you want (i.e. “butterfly”, “potato”, “x”, “y”, “C”). I recommend you to choose variables that you can remember and that make sense to you (i.e. words=[“hola”,”bye”]).
Example
x is the variable, and “hello” is the value assigned to the variable x. BUT REMEMBER! If you then write x = “bye”, you’ll overwrite the variable x with the new value “bye”.
Note 1
Ah, do not forget there are several types of values, and that if you write “hello” or 123 without saving it into a variable, it is also a string or integer respectively!
Note 2
Some examples might look silly, but I promise you that in the right context they make a lot of sense 🙂
Try it yourself
Here you have some variables (of different types!) to play with. You will see some of these types in further detail in the next lessons. For now, try to print the stored values or assign new ones using the interactive console.
Strings
Integers
Floats
Booleans
Tuples
Lists
Ranges
Dictionaries
Sets
Next lesson
Play with strings