dailyprogrammer #393

This commit is contained in:
newt 2024-10-09 18:02:30 +01:00
parent 885c460f6d
commit 96fcc4ab8b
7 changed files with 48 additions and 18 deletions

BIN
assets/dailyprogrammer.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 KiB

View file

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

View file

@ -0,0 +1,16 @@
COINTYPES = [500, 100, 25, 10, 5, 1]
class Change():
def __init__(self, value):
self.value = value # Save the value
self.coins = {} # Create a dictionary for the coins
curr = value # Make a temporary variable to alter
for TYPE in COINTYPES: # For each coin type
index = COINTYPES.index(TYPE) # Get the index
if index > 0: # If the coin type is not at the first index
curr = curr % COINTYPES[index - 1] # Work out the remainder
self.coins[TYPE] = curr // TYPE # And work out how many of the coin type fits into that remainder
self.total = sum(self.coins.values()) # How many coins are there in total?
change = Change(123456)
print(change.coins, change.total)

View file

@ -0,0 +1,10 @@
<div align="center">
<img height="256" src="../../assets/dailyprogrammer.gif" alt="">
<h1>r/dailyprogrammer</h1>
</div>
[The Subreddit](https://reddit.com/r/dailyprogrammer)
- #393 - Making Change
- [Solution](%23393%20-%20Making%20Change.py)
- [Reddit Post](https://www.reddit.com/r/dailyprogrammer/comments/nucsik/20210607_challenge_393_easy_making_change/)

View file

@ -0,0 +1,19 @@
<div align="center">
<img height="256" src="cave.jpg" alt="">
<h1>pythonchallenge.com</h1>
</div>
- [1 - Map](1%20-%20Map.py)
- [2 - OCR](2%20-%20OCR.py)
- [3 - Equality](3%20-%20Equality.py)
- [4 - linkedlist](4%20-%20linkedlist.py)
- [5 - Peak Hell](5%20-%20Peak%20Hell.py)
- [6 - Channel](6%20-%20Channel.py)
- [7 - Oxygen](7%20-%20Oxygen.py)
- [8 - Integrity](8%20-%20Integrity.py)
- [9 - Good](9%20-%20Good.py)
- [10 - Bull](10%20-%20Bull.py)
- [11 - 5808](11%20-%205808.py)
- [12 - Evil](12%20-%20Evil.py)
- [13 - Disproportional](13%20-%20Disproportional.py)
- [14 - Italy](14%20-%20Italy.py)

View file

@ -1,6 +1,5 @@
<!--suppress HtmlDeprecatedAttribute -->
<div align="center">
<img height="256" src="readme.gif" alt="">
<img height="256" src="assets/readme.gif" alt="">
<h1>the honk</h1>
</div>
@ -17,24 +16,10 @@
- [Square Root](python/calculators/Square%20Root.py)
- [Spearman's Rank Correlation Coefficient](python/calculators/SRCC.py)
- [Standard Deviation](python/calculators/Standard%20Deviation.py)
- [osu](python/osu)
- [Get PP from a beatmap ID](python/osu/PP%20from%20Beatmap%20ID.py)
- [osu! - Get PP from a beatmap ID](python/osu/PP%20from%20Beatmap%20ID.py)
- [Pygame Pong](python/pygame%20pong)
- [pythonchallenge.com](python/pythonchallenge.com)
- [1 - Map](python/pythonchallenge.com/1%20-%20Map.py)
- [2 - OCR](python/pythonchallenge.com/2%20-%20OCR.py)
- [3 - Equality](python/pythonchallenge.com/3%20-%20Equality.py)
- [4 - linkedlist](python/pythonchallenge.com/4%20-%20linkedlist.py)
- [5 - Peak Hell](python/pythonchallenge.com/5%20-%20Peak%20Hell.py)
- [6 - Channel](python/pythonchallenge.com/6%20-%20Channel.py)
- [7 - Oxygen](python/pythonchallenge.com/7%20-%20Oxygen.py)
- [8 - Integrity](python/pythonchallenge.com/8%20-%20Integrity.py)
- [9 - Good](python/pythonchallenge.com/9%20-%20Good.py)
- [10 - Bull](python/pythonchallenge.com/10%20-%20Bull.py)
- [11 - 5808](python/pythonchallenge.com/11%20-%205808.py)
- [12 - Evil](python/pythonchallenge.com/12%20-%20Evil.py)
- [13 - Disproportional](python/pythonchallenge.com/13%20-%20Disproportional.py)
- [14 - Italy](python/pythonchallenge.com/14%20-%20Italy.py)
- [r/dailyprogrammer](python/dailyprogrammmer)
### Coursework