Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Pkirkby

New Coder
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!
 
Hi there, Welcome to Code Forum!

Glad to have you on Code Forum! However just make sure to review the code of conduct, you need to place any code you post here at CF within our code BBCode function (</> this icon in the editor).

As for your issue, I’m not too familiar with Python however I’ll see if I can find an answer.
 
Hi there, Welcome to Code Forum!

Glad to have you on Code Forum! However just make sure to review the code of conduct, you need to place any code you post here at CF within our code BBCode function (</> this icon in the editor).

As for your issue, I’m not too familiar with Python however I’ll see if I can find an answer.
Much appreciated, I will get on that code of conduct.
 

Buy us a coffee!

Back
Top Bottom