Question: Hi, could you please help me with these python3 Linux command line questions? Thanks! 1) Write a Python script that uses a function to return

Hi, could you please help me with these python3 Linux command line questions? Thanks!

1)

Write a Python script that uses a function to return the amount of change made from a given value based on the following table of coin values:

0

1

2

3

4

5

1

.35

.23

.12

.03

.01

The function should take in the change due as an argument and return a dictionary of the coin values.

Input string

Expected output of script

Enter a value: 9.76

{'1 coin': 9, '.35 coin': 2, '.23 coin': 0, '.12 coin': 0, '.03 coin': 2, '.01 coin': 0}

2)

Write a Python script that will calculate the change due, if any, for a given payment if the total cost is $16.48, based on the following table of coin values. If the payment is made with exact change, no change will be due. If the payment is over the total amount, then the output will be the change due. If the payment is under the total amount, the output will be how much more is needed. Your script should also provide input checking to ensure that only digits are being entered and are in the correct format before doing any calculations.

0

1

2

3

4

5

1

.35

.23

.12

.03

.01

Input string

Expected output of script

Enter your payment: 20.00

Enter your payment: 16.48

Enter your payment: 10.70

change: 3 1 coins, 1 .35 coins, 1 .12 coins, 1 .03 coins, 2 .01 coins,

No change due

needed: 5 1 coins, 2 .35 coins, 2 .03 coins, 2 .01 coins,

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!