Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

1844804526, 978-1844804528

More Books

Students also viewed these Databases questions