Skip to content

Instantly share code, notes, and snippets.

@Saarth-Jain
Last active October 17, 2020 07:33
Show Gist options
  • Save Saarth-Jain/57f8dbe6279afb05dbf97acb28d65a82 to your computer and use it in GitHub Desktop.
Save Saarth-Jain/57f8dbe6279afb05dbf97acb28d65a82 to your computer and use it in GitHub Desktop.
CS50 solution pset6 cash
from cs50 import get_float
co = 0
coin_count = 0
while (co <= 0):
co = get_float("Change owed: ")
co = co * 100
while co >= 25:
co -= 25
coin_count += 1
while co >= 10:
co -= 10
coin_count += 1
while co >= 5:
co -= 5
coin_count += 1
while co >= 1:
co -= 1
coin_count += 1
print(f"{coin_count}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment