Question: Part 4: Nested Loops You want get n * 100 dollars from the ATM that only gives out 50, 20, and 10 dollar bills. You

Part 4: Nested Loops

You want get n * 100 dollars from the ATM that only gives out 50, 20, and 10 dollar bills. You wish to have at least 5 bills of each kind (at least five $50 bills, at least five $20 bills, and at least five $10 bills). Write a function atm, which takes a number, n and returns all possible ways an ATM can combine these bills in two dimensional array.

Notes:

If there is no way to break n*100 into required combination, have an assertion that fails.

The order of the combinations is not important, but the order within a combination is very important.

Output should look like [[5, 23, 29], [7, 26, 13], ....]. This is an array of arrays of 3 numbers.

For example, atm(12) asks to make change for $1200. One of the combinations of denominations satisfy this quantity is [5, 33, 29] because this means the ATM returns five $50 bills, thirty-three $20 bills and twenty-nine $10 bills, which together sum to $1200.

10, 20, and 50 are magic numbers and thus cannot be used directly in your code. Part 4: Nested Loops You want get n * 100 dollars fromPython 3 language

def atm) Input: the number num (number of 100 dollar bills) Output: all possible ways to break num 100 as a 2D array. #Your code goes here# def atm) Input: the number num (number of 100 dollar bills) Output: all possible ways to break num 100 as a 2D array. #Your code goes here#

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!