Skip to content

Instantly share code, notes, and snippets.

@moqdm
Last active September 6, 2021 13:30
Show Gist options
  • Save moqdm/393a62f58b5996be5dae119949c347f8 to your computer and use it in GitHub Desktop.
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
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