# Having trouble with a coding problem for a course I'm taking involving self-assignment and incremental values

Not looking for the answer, just a hint to a methodology that actually keeps decreasing the amount as I go. I’m currently using floor division as I go.

amount = 67

#You may modify the lines of code above, but don’t move them!
#When you Submit your code, we’ll change these lines to
#assign different values to the variables.

#Write a program that will print out the coins needed to
#arrive at the amount shown above. Assume that we always want
#the maximum number of large coins: for example, for 67 cents,
#we want 2 quarters, 1 dime, 1 nickel, and 2 pennies instead
#of 6 dimes and 7 pennies.

#If you are unfamiliar with American currency: a quarter is
#worth 25 cents; a dime is worth 10 cents; a nickel is worth
#5 cents; a penny is worth 1 cent.

#To make things easier, we’ve gone ahead and supplied your
#print statements. All you need to do is create four variables:
#quarters, dimes, nickels, and pennies.

#HINT: Change the value of amount as you go to reflect what

quarters = 25
dimes = 10
nickels = 5
pennies = 1

#If your code above is correct, the following lines will
#initially print (for amount = 67):
#Quarters: 2
#Dimes: 1
#Nickels: 1
#Pennies: 2
print(“Quarters:”, quarters)
print(“Dimes:”, dimes)
print(“Nickels:”, nickels)
print(“Pennies:”, pennies)

Perhaps you should have a good read of the community guidelines and How to ask good questions (and get good answers). At the moment this reads like you’re asking someone to write your homework for you which is not how this community operates.

1 Like

My apologies. I’m going to word it differently so that I’m asking a method and not the actual answer.