Question: 1. Write a calculation program for tailors with a function that reads in a file (that you create yourself) where each line describes a name

1. Write a calculation program for tailors with a function that reads in a file (that you create yourself) where each line describes a name of a measurement and the measurement itself in inches.

The format will look like this:
Shoulder width 4
Neck width 3.2
Waist 10
 

Hint: you can use the .split() function to do this.
Have the program put these targets in a dictionary with the name of the target as the key value and return the dictionary. Next, create a procedure that accepts a list of measurements and uses inchesToCm that you wrote earlier to print the measurements in centimeters.

#from inches to cm: def inchesToCm(numberInches): assert number Inches > 0 return numberInches * 2.54. 

#from inches to cm: def inchesToCm(numberInches): assert number Inches > 0 return numberInches * 2.54.

Step by Step Solution

3.48 Rating (161 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To use this program create a text file named measurementstxt with the desired measurements in the sp... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!