ATM Bill Disposer simulator
ATM Bill Disposer simulator Data Science Project
Fun and Puzzles

ATM Bill Disposer simulator

his project involves programming the bill dispenser subsystem for an ATM. Use this project to improve your function-writing skills.
Start this project
ATM Bill Disposer simulatorATM Bill Disposer simulator
Project Created by

Santiago Basulto

Project Activities

All our Data Science projects include bite-sized activities to test your knowledge and practice in an environment with constant feedback.

All our activities include solutions with explanations on how they work and why we chose them.

codevalidated

Write the function `calculate_bills_to_use` to calculate the bills usage

Write the function calculate_bills_to_use that returns a dictionary with the bill denomination and how many bills to use. Examples:

>>> calculate_bills_to_use(843)
{500: 1, 100: 3, 50: 0, 25: 1, 10: 1, 5: 1, 1: 3}

>>> calculate_bills_to_use(1763)
{500: 3, 100: 2, 50: 1, 25: 0, 10: 1, 5: 0, 1: 3}

>>> calculate_bills_to_use(177)
{500: 0, 100: 1, 50: 1, 25: 1, 10: 0, 5: 0, 1: 2}

>>> calculate_bills_to_use(355)
{500: 0, 100: 3, 50: 1, 25: 0, 10: 0, 5: 1, 1: 0}

>>> calculate_bills_to_use(10_988)
{500: 21, 100: 4, 50: 1, 25: 1, 10: 1, 5: 0, 1: 3}
codevalidated

Write the function `calculate_bills_to_use_advanced`

Write the function calculate_bills_to_use_advanced that receives two parameters: the amount to withdraw, and a dictionary with bills and their availability. For example:

# There are no $100 bills
>>> calculate_bills_to_use_advanced(163, {
        500: 1,
        100: 0,
        50: 10,
        25: 10,
        10: 10,
        5: 10,
        1: 10
    })
{500: 0, 100: 0, 50: 3.0, 25: 0, 10: 1.0, 5: 0, 1: 3.0}

# There are no $100 or $10 bills
>>> calculate_bills_to_use_advanced(163, {
        500: 1,
        100: 0,
        50: 10,
        25: 10,
        10: 0,
        5: 10,
        1: 10
    })
{500: 0, 100: 0, 50: 3.0, 25: 0, 10: 0, 5: 2.0, 1: 3.0}
ATM Bill Disposer simulatorATM Bill Disposer simulator
Project Created by

Santiago Basulto

This project is part of

Fun and Puzzles

Explore other projects