从昨天晚上开始,我在一个颤振项目中遇到了下面的问题。问题是我没有改变任何东西,所以我不知道要回滚什么。已针对此问题列出了一种解决方案 here,但不起作用。
def calculateChanges( quarters, dimes, nickels, pennies):
twentyFive = .25
tens = .10
fives = .05
ones = .01
twentyFive = int(twentyFive) * int(quarters)
tens = int(tens) * int(dimes)
fives = int(fives) * int(nickels)
ones = int(ones) * int(pennies)
combineAll = twentyFive + tens + fives + ones
return combineAll
theName = input('What is your name (Return/Enter to quit)?')
while theName == theName:
theFirst = input('How many quarter do you have? ')
theSecond = input('How many dimes do you have? ')
theThird = input('How many nickels do you have? ')
theLast = input('How many pennies do you have? ')
justTotal = calculateChanges(theFirst, theSecond, theThird, theLast)
print('All counted,',theName, 'has: $'+ str(justTotal))
else:
print('Bye')