I am a student and my assignment is to write a change calculator program.I have got to go from Dollars down to pennies (not to much work) but I lost my notes (Kinda stupid of me) and I dont know how to fix my program.Please help

print 'Hello please enter number of Dollar coins.'
Dollarcoins_value=(1.00)
strDollarcoins=raw_input()
    
print 'Please enter number of Half Dollars.'
HalfDollars_value=(0.50)
strHalfDollars=raw_input()
    
print 'Please enter number of Quarters.'
Quarters_value=(0.25)
strQuarters=raw_input()
    
print 'Please enter number of Dimes.'
Dimes_value=(0.10)
strDimes=raw_input()
    
print 'Please enter number of Nickels.'
Nickels_value=(0.05)
strNickels=raw_input()
    
print 'Please enter number of Pennies.'
Pennies_value=(0.01)
strPennies=raw_input()

Valueof_Dollars_HalfDollars_Quarters_Dimes_Pennies=

How about this:

amount = 0.0
for kind, value in (
    ('Dollar coins', 1.00),
    ('Quarters', 0.25),
    ('Dimes', 0.10),
    ('Nickels', 0.05),
    ('Pennies', 0.01)
    ):
    amount += int(raw_input('Please enter number of %s: ' % kind )) * value
    
print ("You have $%.2f." % amount)

Thank you so much. Do you know what was wrong with my code?

Can't tell if your code is wrong, since your last line is incomplete.
The above solution put everything inside a loop to make it more elegant.
Your code should still work if you remember to cast the input you get using
raw_input() with int() in your last line.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.