PDA

View Full Version : Anybody here good with phython?



netsfan549
04-23-2014, 05:29 PM
I just have a question with a project. I almost done but I am missing something. Thank you.

SpecialQue
04-23-2014, 05:31 PM
The ladies say I'm great with mine.

ace23
04-23-2014, 05:40 PM
Post the code.

STATUTORY
04-23-2014, 05:41 PM
why not staxexchange or something?

this really seems like a peculiar forum to ask this sort of questions

netsfan549
04-23-2014, 05:42 PM
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

ace23
04-23-2014, 05:47 PM
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.