Friday, 30 October 2015

Using the PyShell as a calculator.

#We open Python. We work directly on the Shell (not IDLE). We are not going to save.

# MATHEMATICS
#Adding. Try:
6+7
6+7+6
-1+-3

#Subtracting
7-6
6-7
-3--3

#Multiplying
6*7
45678*123456789
Try enormous numbers. How long does it take the computer to solve?

#Division
25/5
3/25

#MIXING operations
2+3*6/4-1

#Brackets
4+3*6
(4+3)*6
4+(3*6)

#These three last operations have the same numbers, yet they are two different algorithms.
Do you understand?

#Squared
4**2

#Cubic numbers etc
4**3
4**4

#Mixed Operations
7 (2*6)
7-(2*6)
-(7-(2*6)+1))
5+30*20/10

Try it all. Invent your own.