Indentation
Python uses indentation for blocks, instead of curly braces. Both tabs and spaces are supported, but the standard indentation requires standard Python code to use four spaces.
Numbers
Python supports two types of numbers - integers(whole numbers) and floating point numbers(decimals). (It also supports complex numbers, which will not be explained in this tutorial).
Strings
Strings are defined either with a single quote or a double quotes.
Lists
Lists are very similar to arrays. They can contain any type of variable, and they can contain as many variables as you wish. Lists can also be iterated over in a very simple manner.
Arithmetic Operators
Just as any other programming languages, the addition, subtraction, multiplication, and division operators can be used with numbers.
number = 1 + 2 * 3 / 4.0
print(number)
Another operator available is the modulo (%) operator, which returns the integer remainder of the division. dividend % divisor = remainder.
remainder = 11 % 3
print(remainder)
Using two multiplication symbols makes a power relationship.
squared = 7 ** 2
cubed = 2 ** 3
print(squared)
print(cubed)
Using Operators with Strings
Python supports concatenating strings using the addition operator
helloworld = "hello" + " " + "world"
print(helloworld)
Python also supports multiplying strings to form a string with a repeating sequence
lotsofhellos = "hello" * 10
print(lotsofhellos)
Using Operators with Lists
Lists can be joined with the addition operators
even_numbers = [2,4,6,8]
odd_numbers = [1,3,5,7]
all_numbers = odd_numbers + even_numbers
print(all_numbers)
Just as in strings, Python supports forming new lists with a repeating sequence using the multiplication operator
print([1,2,3] * 3)
String Formatting
Python uses C-style string formatting to create new, formatted strings. The "%" operator is used to format a set of variables enclosed in a "tuple" (a fixed size list), together with a format string, which contains normal text together with "argument specifiers", special symbols like "%s" and "%d".
# This prints out "Hello, John!"
name = "John"
print("Hello, %s!" % name)
To use two or more argument specifiers, use a tuple (parentheses)
# This prints out "John is 23 years old."
name = "John"
age = 23
print("%s is %d years old." % (name, age))
Any object which is not a string can be formatted using the %s operator as well. The string which returns from the "repr" method of that object is formatted as the string.
mylist = [1,2,3]
print("A list: %s" % mylist)
Here are some basic argument specifiers you should know
%s - String (or any object with a string representation, like numbers)
%d - Integers
%f - Floating point numbers
%.<number of digits>f - Floating point numbers with a fixed amount of digits to the right of the dot.
%x/%X - Integers in hex representation (lowercase/uppercase)
https://www.w3schools.com/python/default.asp