Python chapter 5 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

Python chapter 5

Assignment #2- Chapter 4 Problem Compare Costs Suppose you shop for rice in two different packages. You would like to write a proto compare the cost. The program reads from an input file the weight (in lbs) and price (in dollars.cents) of each package and displays the one with the better price Sample input file: 50 24.59 25 11.99 Sample run: The weight and price for package 1: 50 lbs, $24.59 The weight and price for package 2: 25 lbs, $11.99 Package 2 has a better price. Another sample input file: 10 11.00 5 6.00 Sample run: The weight and price for package 1: 10 lbs, $11.00 The weight and price for package 2: 5 lbs, $6.00 Package 1 has a better price. Another sample input file: 50 25.00 25 12:50 Another sample run is shown below The weight and price for package 1: 50 lbs, $25.00 The weight and price for package 2: 25 lbs, $12.50 The two packages have the same price. Your sample run should look EXACTLY the same (except for the red text color and bold font) as the above using the same

2nd Feb 2022, 2:59 PM
lana gillespie
1 Answer
+ 1
Just follow the hint "...determine the cost per pound in order to compare." Cost per pound = pounds / price
2nd Feb 2022, 3:17 PM
CGM
CGM - avatar