0

The program will allow me to input the values, but their is no calculations and it doesn't print. I have moved the endProgram input all over and it just turns it into an infinite loop.

def main ():
 endProgram = "no"
 while endProgram == "no":
        totalBottles = getBottles()
        totalPayout = calcPayout(totalBottles)
        printInfo = (totalBottles, totalPayout)
        endProgram = raw_input("Do you want to end the program? Enter yes or no:") 

def getBottles():
    counter = 1
    totalBottles = 0
    todayBottles = 0

    while counter <= 7:
        todayBottles = input("Enter number of bottles for today:")
        totalBottles = totalBottles + todayBottles
        counter = counter + 1
    return totalBottles

def calcPayout(totalBottles):
    totalPayout = 0
    totalPayout = totalBottles * .10
    return totalPayout
def printInfo(totalBottles,totalPayout):
    print "The total bottles collected is:",totalBottles
    print "The total payout is $ :",totalPayout
2
  • Do you call main() somewhere? As stands, this code will exit without doing anything. Commented Jan 22, 2016 at 21:17
  • Yes main() is at the end. I guess it didn't get picked up on the copy. Commented Jan 22, 2016 at 21:31

2 Answers 2

3

To print you have to remove = in line (because it assigns values to variable)

 printInfo = (totalBottles, totalPayout)

It has to be:

 printInfo(totalBottles, totalPayout)

This way you call function with variables.

Sign up to request clarification or add additional context in comments.

1 Comment

I can't believe it was that simple oversight. Thank you so much!!
0

You are assigning a tuple (totalBottles, totalPayout) to a function, that is the reason why is not working.

printInfo is a function that only prints and has no returns... therefore change the statement

printInfo = (totalBottles, totalPayout)

for printInfo(totalBottles, totalPayout)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.