CMPT 120 Chapter 2: Study Guide Readings Part 20

30 views2 pages
meghan78 and 39786 others unlocked
CMPT 120 Full Course Notes
29
CMPT 120 Full Course Notes
Verified Note
29 documents

Document Summary

The notation 5 3 is used to indicate 5 feet and 3 inches , which is 5 12 + 3 = 63 inches. To do this conversion, convert the number of metres to inches by multiplying by 39. 37. Then, determine how many feet and inches there are in the total number of inches. Note that when you run this program, it calculates the number of feet as a floating point number: This makes sense, given what we know about types: when python divides a floating point value (metres), it returns a floating point value. But in the algorithm, you need an integer and it needs to be rounded down to the next integer. This is what the int function does when it converts floating point numbers to integers, so you can use that to get the correct value in feet. Once you have the correct number of feet as an integer, you can calculate the number of inches too.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents