The third activity that you’ll do is modify some Python code to convert a number of feet to a number of metres in length. The formula for this is given below.
In the editor below, fill in the blanks (________
) so that the program calculates the number of metres in the given number of feet, and print
the results back to the user.
Need some help? Click here to reveal a video walkthrough for this task!
print
the result back to the user.3.281
. For example, 6 feet in metres would be: 6 / 3.281 = 1.8287
.feet
in the code. Does your result change? If it doesn’t, make sure you are using variables and that you’re printing the right one!1.828710758914965
. That’s okay! As an extension task, put your calculation into a round()
command along with the number of digits you want to round to, for example: rounded = round(6 / 3.281, 2)
.Below is an example of how the program should run:
Number of feet in length:
6
Number of metres in length:
1.828710758914965