/coin-problem

Split Euro amount in the minimal amount of coins

Primary LanguagePythonMIT LicenseMIT

Coin Problem

Part 1

You are given an amount of money in the format 2.88. Split this amount in the minimal amount of Euro coins, which represents the given number. The expected format would be: [ 2, 0.5, 0.2, 0.1, 0.05, 0.02, 0.01]

The Euro coins are:

2€, 1€, 50¢, 20¢, 10¢, 5¢, 2¢, 1¢

Implement the corresponding function.

Part 2:

Try to reduce the code to the minimal amount of characters! Spaces, linebreaks etc are counted.

For execute the program

  1. The part1 script could be executed using the following command:
    python3 part1.py 2.88
    You can substitute 2.88 by whatever number of your election

  2. The part2 script could be executed using the following command:
    python3 part2.py 2.88

  3. Execute the included unit tests:
    In the same terminal, execute the following command:
    python3 test_part1.py