Using Python as a calculator

Exercise 1:

Enter Python in the interactive mode. You should see a message

In [1]:

Complete the following calculations by filling in the blanks:

In [1]: 1 + ___
Out[1]: 3

In [2]: 12 ___ 8
Out[2]: 4

In [3]: ___ * 5
Out[3]: 20

In [4]: 21 / 7
Out[4]: ___

In [5]: ___ ** 2
Out[5]: 81

Enter the commands to see what happens (do not type the first part In [1] etc., these will appear automatically).

Exercise 2:

Which operations result in 8?

  • 0 + 8
  • 4 4
  • 8 /
  • 65 // 8
  • 17 % 9
  • 2 * * 4
  • 64 ** 0.5

Exercise 3:

Collect the Python operators you already know in a table (+, -, * etc.).

results matching ""

    No results matching ""