ubuntu2004
Exercise 3.1
In your head, or on paper, work out the following arithmetic as you would expect Python to do it using the rules of precedence.
5 * 5 - 5 = ?
10 - 2 * 3 = ?
20 + 5 * 2 - 10 = ?
4 + 4 / 2 = ?
2 * 5 ** 2 = ?
9 / 3 ** 2 = ?
Check your answers by typing them into the code cell below.
Exercise 3.2
What are the types of each of the following numbers?
-6
10.3
99.0
-1.0
Check your answers in the code cell below.
Exercise 3.3
What type of number do you get if you do
4 / 2
?What type of number do you get if you do
4 // 2
?
Check your answer below.
Exercise 3.4
Round the following floats to the given number of decimal places.
34.2694 to 2dp
-1.4 to 0dp
1024.234 to 1dp
Exercise 3.5
What are the circumference and area of a circle of radius 5.4 cm rounded to 1 decimal place?
If you've forgotten what the circumference and area of a circle are use google.
Exercise 3.6
In the code cell below calculate the average of the following set of numbers to 2dp:
Exercise 3.7
Using Python code calculate what 321 minutes is in hours and minutes? (E.g., 61 minutes is 1 hour and 1 minute.)
Find the remainder of the following: