CMPT 120 Chapter 2: Study Guide Readings Part 20

29 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+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents