Last active
September 6, 2021 13:30
-
-
Save moqdm/393a62f58b5996be5dae119949c347f8 to your computer and use it in GitHub Desktop.
it's my PSet 6: Sentimental / Cash solution... *Please just take a look if you couldn't solve it ... Thank you π #cs50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cs50 import get_float | |
c = 0 | |
# Get owe... | |
print("Write down the amount you owe to calculate the number of coins like ($.Β’)... ") | |
o = 0 | |
while True: | |
o = get_float("Owed: ") | |
if o > 0: | |
break | |
# rounding number. | |
ce = round(o * 100) | |
# Quarter. | |
while 25 <= ce: | |
ce -= 25 | |
c += 1 | |
# Dime. | |
while 10 <= ce: | |
ce -= 10 | |
c += 1 | |
# Nickel. | |
while 5 <= ce: | |
ce -= 5 | |
c += 1 | |
# Penny. | |
while 1 <= ce: | |
ce -= 1 | |
c += 1 | |
# End! | |
print(c) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment