First, let's print hello world!
>>>print "Hello, World"
>>>print ("Hello, World")
Arithmetic
>>> 2+5
7
>>> 5-2
3
>>> 10/2
5
>>> 5*2
10
>>> 10/5+1
3
>>> 2*3-4
2
In the above operation, four are related to the operation symbol: plus (+), subtract (-), multiply (*), divide (/)
>>> 2 + 2
4
>>> 50 - 5*6
20
>>> (50 - 5*6) / 4
5.0
>>> 8 / 5 # division always returns a floating point number
1.6
Divide (/) always returns a float type number. Do floor and get an integer division results (returns the integer portion of the quotient) // operator can be used; the remainder may be used to calculate%:
>>> 17 / 3 # classic division returns a float
5.666666666666667
>>>
>>> 17 // 3 # floor division discards the fractional part
5
>>> 17 % 3 # the % operator returns the remainder of the division
2
>>> 5 * 3 + 2 # result * divisor + remainder
17