In [1]:
print ("Hello World")


Out[1]:
4

In [3]:
>>> 2 + 2


Out[3]:
4

In [4]:
>>> 4 - 2


Out[4]:
2

In [6]:
>>> 2 * 2


Out[6]:
4

In [9]:
>>> 7 / 3 # Division always returns a floating number


Out[9]:
2.3333333333333335

In [7]:
>>> 5 // 2 # Floor Division


Out[7]:
2

In [8]:
>>> 7 % 3 # Remainder


Out[8]:
1

In [10]:
>>> 2 ** 4 # Square


Out[10]:
16

In [11]:
>>> 5 ** 7 # 5 to the powder of 7


Out[11]:
78125

In [14]:
>>> width = 5
>>> height = 7
>>> width * height # "=" is used to assign a value to variable


Out[14]:
35

In [15]:
>>> n


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-15-fe13119fb084> in <module>()
----> 1 n

NameError: name 'n' is not defined

In [16]:
>>> 3.5 * 2.7


Out[16]:
9.450000000000001

In [17]:
>>> 3.5 * 2


Out[17]:
7.0

In [20]:
>>> tax = 12.5 / 100
>>> price = 100.50
>>> price * tax
>>> price + _
>>> round ( _ , 2 ) ###"_"代表最后一个算出来的数


Out[20]:
12.56