Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> print(3+1) 4 >>> 3 + 1 4 >>> print(1 + 2 + 3 * 3) 12 >>> print((1 + 2 + 3) * 3) 18 >>> print(3**2) 9 >>> print(9 % 2) 1 >>> print(15 // 4) 3 >>> print(16 // 4) 4 >>> print(-5 // 4) -2 >>> print((23 + 32 + 64)/ 3) 39
integer and floats
>>> print(3/4) 0 >>> print(16/4) 4 >>> 3 + 2.5 5.5 >>> 213.13 213.13 >>> 341. 341.0 >>> int(49.7) 49 >>> int(16/4) 4 >>> float(3520+3239) 6759.0 >>> print(0.1) 0.1 >>> print(0.1 + 0.1 + 0.1) 0.3
float e.g.
Length of a fish you caught, in metres
Length of time it took to catch the first fish, in hours
4.445e8 is equal to 4.445 * 10 ** 8 which is equal to 444500000.0.
# The current volume of a water reservoir (in cubic metres) reservoir_volume = 4.445e8 # The amount of rainfall from a storm (in cubic metres) rainfall = 5e6 # decrease the rainfall variable by 10% to account for runoff rainfall *= 0.9 # add the rainfall variable to the reservoir_volume variable reservoir_volume += rainfall # increase reservoir_volume by 5% to account for stormwater that flows reservoir_volume *= 1.05 # into the reservoir in the days following the storm # decrease reservoir_volume by 5% to account for evaporation reservoir_volume *= 0.95 # subtract 2.5e5 cubic metres from reservoir_volume to account for water # that's piped to arid regions. reservoir_volume -= 2.5e5 # print the new value of the reservoir_volume variable print(reservoir_volume)