-
Anybody here good with phython?
I just have a question with a project. I almost done but I am missing something. Thank you.
-
NBA Superstar
Re: Anybody here good with phython?
The ladies say I'm great with mine.
-
*****
Re: Anybody here good with phython?
-
Bear Chested Da Brawn
Re: Anybody here good with phython?
why not staxexchange or something?
this really seems like a peculiar forum to ask this sort of questions
-
Re: Anybody here good with phython?
The code is #constants
cashvalue = 150
couponcnt = 0
grandtotal = 0
customercnt = 0
totalcoupons = 0
cnt = 0
total = 0
from random import randint
#processing section
def maindriver():
cashvalue = 150
answer = input("do you have a customer Y/N:").upper()
while answer == "Y":
invoice = randint(1,9999)
total = 0
cnt = 0
totalcoupons = 0
amount = float(input("Enter items cost? : "))
while (amount != 0):
total += amount
cnt += 1
amount = float(input("Enter other items cost? "))
respond = input("Do you have any Coupons? Y/N : ").upper()
#while respond == 'Y':
number = int(input("Enter number of coupons: "))
for I in range (number):
costofcoupons = float(input("Enter coupons cost? "))
totalcoupons += costofcoupons
avg = total/cnt
totaldue = total-totalcoupons
cashvalue += totaldue
#Output Section
print ((55 * " "), "Invoice :", invoice)
print()
print("The number of items:",cnt)
#loop will start
print("Total bill before all coupons are: ",format(total,"6.2f"))
print("Average item cost ", avg)
print("The Cash register has",cashvalue)
customercnt =+ 1
answer = input("Another Customer? Y/N:").upper()
maindriver()
input("Press Enter to Continue")
I need to do this At the end the program print the number of customers processed, the average purchase per customer and the total amount of money in the cash register.
I dont know how
-
*****
Re: Anybody here good with phython?
I don't understand what you're trying to accomplish with your code, but why can't you just keep +=1 for every customer and a += amount for every transaction as the total cash variable, then at the end divide total cash by customers?
I think you already have the variables in there. All you have to do is print them.
Last edited by ace23; 04-23-2014 at 05:52 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|