Python Forum
Issues with Nickel Calculation
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issues with Nickel Calculation
#1
#Change.PY
# A program to calculate the value of change

def main():
    print("Change Counter")
    print()
    print("Enter count of each coin type.")
    quarters = eval(input("Quarters: "))
    dimes = eval(input("Dimes: "))
    nickels = eval(input("Nickels: "))
    pennies = eval(input("Pennies: "))
    Quarters2 = quarters * .25
    print()
    print("Quarters: ", Quarters2)
    Dimes2 = dimes * .10
    print()
    print("Dimes: ", Dimes2)
    Nickels2 = nickels * .05
    print()
    print("Nickels: ", Nickels2)
    Pennies2 = pennies * .01
    print()
    print("Pennies: ", Pennies2)
    total = Quarters2 + Dimes2 + Nickels2 + Pennies2
    print()
    print("The total value of your change is", total)

main()
It creates the prompt for the amount of change input as requested
it calculates the value of each coin
and it processes the total
however, the math is wrong.
it seems the nickels are not being calculated correctly and i can not figure out how
any help would be fantastic.
Reply


Messages In This Thread
Issues with Nickel Calculation - by CrashAndBurn2018 - Mar-30-2018, 10:04 AM
RE: Issues with Nickel Calculation - by Larz60+ - Mar-30-2018, 10:56 AM
RE: Issues with Nickel Calculation - by snippsat - Mar-30-2018, 11:17 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020