Question: 4.) Write a function called convert_from_copper that takes a single integer argument representing a number of copper pieces. The function prints out the number
4.) Write a function called convert_from_copper that takes a single integer argument representing a number of copper pieces. The function prints out the number of gold pieces (gp), silver pieces (sp), and copper pieces (cp) you would end up with if you first converted as many of the initial copper pieces to gold as possible and then converted as many of the remaining copper pieces as possible to silver pieces. Here are some examples of calling the function with different arguments. (The code executed is in blue, the output produced is in green): convert_from_copper (200) 200 copper pieces is: 4 gp, 0 sp, 0 cp convert_from_copper (1107) 1107 copper pieces is: 22 gp, 1 sp, 2 cp convert_from_copper (3242) 3242 copper pieces is: 64 gp, 8 sp, 2 CP
Step by Step Solution
3.34 Rating (154 Votes )
There are 3 Steps involved in it
Python def convertfromcoppercopperpieces gp copperpieces 100 remainingcopper copperpieces 100 sp ... View full answer
Get step-by-step solutions from verified subject matter experts
