Core Python

Variables

Variables, just like any programming language, can be declared and assigned on the spot. The most common types you will likely be dealing with are numbers and strings, among other things.

Numbers

Numbers can be integers or floats and are declared on the spot

Note that Python automatically detects the data type of a variable. This is called dynamic typing.

Strings

Strings are a special type of variable that represent text. Simply use single (or double) quotations to define a string variable.

You can also concatenate (add) strings together

 
str = str1 + str2