{"id":16565107,"url":"https://github.com/shonharsh/python-exercism-s02e01-numbes-currencyexchange","last_synced_at":"2026-05-07T03:37:32.920Z","repository":{"id":245517302,"uuid":"818490589","full_name":"ShonHarsh/Python-Exercism-S02E01-Numbes-CurrencyExchange","owner":"ShonHarsh","description":"Exercism - This Python project is about Numbers.","archived":false,"fork":false,"pushed_at":"2024-06-22T02:07:20.000Z","size":81,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T08:35:50.509Z","etag":null,"topics":["academic","artificial-intelligence","atom","automation","bot","config","education","exercism","git","guide","learning","markdown","numbers","process","python","studio","testing","training-materials","trending","windows"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ShonHarsh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-22T01:44:12.000Z","updated_at":"2025-02-07T00:57:56.000Z","dependencies_parsed_at":"2024-06-22T15:07:58.320Z","dependency_job_id":null,"html_url":"https://github.com/ShonHarsh/Python-Exercism-S02E01-Numbes-CurrencyExchange","commit_stats":null,"previous_names":["shonharsh/python-exercism-s02e01-numbes-currencyexchange"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ShonHarsh/Python-Exercism-S02E01-Numbes-CurrencyExchange","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShonHarsh%2FPython-Exercism-S02E01-Numbes-CurrencyExchange","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShonHarsh%2FPython-Exercism-S02E01-Numbes-CurrencyExchange/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShonHarsh%2FPython-Exercism-S02E01-Numbes-CurrencyExchange/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShonHarsh%2FPython-Exercism-S02E01-Numbes-CurrencyExchange/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShonHarsh","download_url":"https://codeload.github.com/ShonHarsh/Python-Exercism-S02E01-Numbes-CurrencyExchange/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShonHarsh%2FPython-Exercism-S02E01-Numbes-CurrencyExchange/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260769584,"owners_count":23060138,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["academic","artificial-intelligence","atom","automation","bot","config","education","exercism","git","guide","learning","markdown","numbers","process","python","studio","testing","training-materials","trending","windows"],"created_at":"2024-10-11T20:46:06.083Z","updated_at":"2026-05-07T03:37:32.896Z","avatar_url":"https://github.com/ShonHarsh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Banner](Data/Images/Python-Exercism-S02E01-Numbes-CurrencyExchange-Banner.png)\n\n### Python-Exercism-S02E01-Numbes-CurrencyExchange\n\nThis repository my work for the [Exercism](https://exercism.org/) Python track.\n\n### Download Command\n`exercism download --track=python --exercise=currency-exchange`\n\n### Submission Command\n`exercism submit \"Exercism\\python\\currency-exchange\\exchange.py\"`\n\n## Testing Command\n`pytest -o markers=task`\n\n![Banner](Data/Images/Python-Exercism-S02-Numbes-Title.png)\n\n# Currency Exchange\n\nWelcome to Currency Exchange on Exercism's Python Track.\nIf you need help running the tests or submitting your code, check out `HELP.md`.\nIf you get stuck on the exercise, check out `HINTS.md`, but try and solve it without using those first :)\n\n## Introduction\n\n## Numbers\n\nThere are three different kinds of built-in numbers in Python : `ints`, `floats`, and `complex`. However, in this exercise you'll be dealing only with `ints` and `floats`.\n\n### ints\n\n`ints` are whole numbers. e.g. `1234`, `-10`, `20201278`.\n\nIntegers in Python have [arbitrary precision][arbitrary-precision] -- the number of digits is limited only by the available memory of the host system.\n\n### floats\n\n`floats` are numbers containing a decimal point. e.g. `0.0`,`3.14`,`-9.01`.\n\nFloating point numbers are usually implemented in Python using a `double` in C (_15 decimal places of precision_), but will vary in representation based on the host system and other implementation details. This can create some surprises when working with floats, but is \"good enough\" for most situations.\n\nYou can see more details and discussions in the following resources:\n\n- [Python numeric type documentation][numeric-type-docs]\n- [The Python Tutorial][floating point math]\n- [Documentation for `int()` built in][`int()` built in]\n- [Documentation for `float()` built in][`float()` built in]\n- [0.30000000000000004.com][0.30000000000000004.com]\n\n## Arithmetic\n\nPython fully supports arithmetic between `ints` and `floats`. It will convert narrower numbers to match their less narrow counterparts when used with the binary arithmetic operators (`+`, `-`, `*`, `/`, `//`, and `%`). When division with `/`, `//` returns the quotient and `%` returns the remainder.\n\nPython considers `ints` narrower than `floats`. So, using a float in an expression ensures the result will be a float too. However, when doing division, the result will always be a float, even if only integers are used.\n\n```python\n# The int is widened to a float here, and a float type is returned.\n\u003e\u003e\u003e 3 + 4.0\n7.0\n\u003e\u003e\u003e 3 * 4.0\n12.0\n\u003e\u003e\u003e 3 - 2.0\n1.0\n# Division always returns a float.\n\u003e\u003e\u003e 6 / 2\n3.0\n\u003e\u003e\u003e 7 / 4\n1.75\n# Calculating remainders.\n\u003e\u003e\u003e 7 % 4\n3\n\u003e\u003e\u003e 2 % 4\n2\n\u003e\u003e\u003e 12.75 % 3\n0.75\n```\n\nIf an int result is needed, you can use `//` to truncate the result.\n\n```python\n\u003e\u003e\u003e 6 // 2\n3\n\u003e\u003e\u003e 7 // 4\n1\n```\n\nTo convert a float to an integer, you can use `int()`. Also, to convert an integer to a float, you can use `float()`.\n\n```python\n\u003e\u003e\u003e int(6 / 2)\n3\n\u003e\u003e\u003e float(1 + 2)\n3.0\n```\n\n[0.30000000000000004.com]: https://0.30000000000000004.com/\n[`float()` built in]: https://docs.python.org/3/library/functions.html#float\n[`int()` built in]: https://docs.python.org/3/library/functions.html#int\n[arbitrary-precision]: https://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic#:~:text=In%20computer%20science%2C%20arbitrary%2Dprecision,memory%20of%20the%20host%20system.\n[floating point math]: https://docs.python.org/3.9/tutorial/floatingpoint.html\n[numeric-type-docs]: https://docs.python.org/3/library/stdtypes.html#typesnumeric\n\n## Instructions\n\nYour friend Chandler plans to visit exotic countries all around the world. Sadly, Chandler's math skills aren't good. He's pretty worried about being scammed by currency exchanges during his trip - and he wants you to make a currency calculator for him. Here are his specifications for the app:\n\n## 1. Estimate value after exchange\n\nCreate the `exchange_money()` function, taking 2 parameters:\n\n1. `budget` : The amount of money you are planning to exchange.\n2. `exchange_rate` : The amount of domestic currency equal to one unit of foreign currency.\n\nThis function should return the value of the exchanged currency.\n\n**Note:** If your currency is USD and you want to exchange USD for EUR with an exchange rate of `1.20`, then `1.20 USD == 1 EUR`.\n\n```python\n\u003e\u003e\u003e exchange_money(127.5, 1.2)\n106.25\n```\n\n## 2. Calculate currency left after an exchange\n\nCreate the `get_change()` function, taking 2 parameters:\n\n1. `budget` : Amount of money before exchange.\n2. `exchanging_value` : Amount of money that is *taken* from the budget to be exchanged.\n\nThis function should return the amount of money that *is left* from the budget.\n\n```python\n\u003e\u003e\u003e get_change(127.5, 120)\n7.5\n```\n\n## 3. Calculate value of bills\n\nCreate the `get_value_of_bills()` function, taking 2 parameters:\n\n1. `denomination` : The value of a single bill.\n2. `number_of_bills` : The total number of bills.\n\nThis exchanging booth only deals in cash of certain increments.\nThe total you receive must be divisible by the value of one \"bill\" or unit, which can leave behind a fraction or remainder.\nYour function should return only the total value of the bills (_excluding fractional amounts_) the booth would give back.\nUnfortunately, the booth gets to keep the remainder/change as an added bonus.\n\n```python\n\u003e\u003e\u003e get_value_of_bills(5, 128)\n640\n```\n\n## 4. Calculate number of bills\n\nCreate the `get_number_of_bills()` function, taking `amount` and `denomination`.\n\nThis function should return the _number of currency bills_ that you can receive within the given _amount_.\nIn other words:  How many _whole bills_ of currency fit into the starting amount?\nRemember -- you can only receive _whole bills_, not fractions of bills, so remember to divide accordingly.\nEffectively, you are rounding _down_ to the nearest whole bill/denomination.\n\n```python\n\u003e\u003e\u003e get_number_of_bills(127.5, 5)\n25\n```\n\n## 5. Calculate leftover after exchanging into bills\n\nCreate the `get_leftover_of_bills()` function, taking `amount` and `denomination`.\n\nThis function should return the _leftover amount_ that cannot be returned from your starting _amount_ given the denomination of bills.\nIt is very important to know exactly how much the booth gets to keep.\n\n```python\n\u003e\u003e\u003e get_leftover_of_bills(127.5, 20)\n7.5\n```\n\n## 6. Calculate value after exchange\n\nCreate the `exchangeable_value()` function, taking `budget`, `exchange_rate`, `spread`, and `denomination`.\n\nParameter `spread` is the *percentage taken* as an exchange fee, written as an integer.\nIt needs to be converted to decimal by dividing it by 100.\nIf `1.00 EUR == 1.20 USD` and the *spread* is `10`, the actual exchange rate will be: `1.00 EUR == 1.32 USD` because 10% of 1.20 is 0.12, and this additional fee is added to the exchange.\n\nThis function should return the maximum value of the new currency after calculating the *exchange rate* plus the *spread*.\nRemember that the currency *denomination* is a whole number, and cannot be sub-divided.\n\n**Note:** Returned value should be `int` type.\n\n```python\n\u003e\u003e\u003e exchangeable_value(127.25, 1.20, 10, 20)\n80\n\u003e\u003e\u003e exchangeable_value(127.25, 1.20, 10, 5)\n95\n```\n\n## Source\n\n### Created by\n\n- @Ticktakto\n- @Yabby1997\n- @limm-jk\n- @OMEGA-Y\n- @wnstj2007\n- @J08K\n\n### Contributed to by\n\n- @BethanyG\n- @kytrinyx\n- @pranasziaukas\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshonharsh%2Fpython-exercism-s02e01-numbes-currencyexchange","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshonharsh%2Fpython-exercism-s02e01-numbes-currencyexchange","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshonharsh%2Fpython-exercism-s02e01-numbes-currencyexchange/lists"}