Hi everyone, first post here. I'm pretty new to python and most other coding programs, but I'm in school for Computer programming currently. I'm working on a simple project, and I just want to add one simple detail, and I can't seem to get it. I will post my code after I give a brief explanation. Under my "def getBottles()" Function, down in my "While" statement, I have this line:
todayBottles = float(input('Enter the amount of bottles returned for the day '),counter)
I would like for it to say "float(input('Enter the amount of bottles returned day '),counter) (in this case the counter is just counting days, so it should print out "day 1, day 2 , day 7 etc.")
My assumption was that I didn't call or reference anything in my def getBottles function, but after a while of fooling around I cant seem to get it. Here is the rest of my code:
#The main function
def main():
endProgram = 'no'
while endProgram == 'no':
totalBottles = getBottles()
totalPayout = calcPayout(totalBottles)
printInfo(totalBottles, totalPayout)
endProgram = input('Do you want to end the program? (Enter yes or no): ')
#This function gets amount of bottles and increments the counter for days of the week
def getBottles():
totalBottles = 0
todayBottles = 0
counter = 1
while counter <= 7:
todayBottles = float(input('Enter the amount of bottles returned for the day '),counter)
totalBottles = totalBottles + todayBottles
counter = counter + 1
return totalBottles
# this function will calculate the payout
def calcPayout(totalBottles):
totalPayout = 0
totalPayout = totalBottles * .10
return totalPayout
# this function will display the information
def printInfo(totalBottles, totalPayout):
print (('The total number of bottles collected is'), totalBottles)
print (('The total paid out is $'), totalPayout)
# calls main
main()
Thanks in advance!
todayBottles = float(input('Enter the amount of bottles returned for the day '),counter)
I would like for it to say "float(input('Enter the amount of bottles returned day '),counter) (in this case the counter is just counting days, so it should print out "day 1, day 2 , day 7 etc.")
My assumption was that I didn't call or reference anything in my def getBottles function, but after a while of fooling around I cant seem to get it. Here is the rest of my code:
#The main function
def main():
endProgram = 'no'
while endProgram == 'no':
totalBottles = getBottles()
totalPayout = calcPayout(totalBottles)
printInfo(totalBottles, totalPayout)
endProgram = input('Do you want to end the program? (Enter yes or no): ')
#This function gets amount of bottles and increments the counter for days of the week
def getBottles():
totalBottles = 0
todayBottles = 0
counter = 1
while counter <= 7:
todayBottles = float(input('Enter the amount of bottles returned for the day '),counter)
totalBottles = totalBottles + todayBottles
counter = counter + 1
return totalBottles
# this function will calculate the payout
def calcPayout(totalBottles):
totalPayout = 0
totalPayout = totalBottles * .10
return totalPayout
# this function will display the information
def printInfo(totalBottles, totalPayout):
print (('The total number of bottles collected is'), totalBottles)
print (('The total paid out is $'), totalPayout)
# calls main
main()
Thanks in advance!