-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
50 lines (40 loc) · 1.35 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import datetime
import random
import os
#Global Variables
print(" SG Mall ")
product_list = []
price_list = []
quantity_list = []
final_price = []
total = 0
serial = random.randint(100, 10000)
date = datetime.date.today()
customer_name = input("Customer name : ")
customer_mobile = input("Mobile Number : ")
def purchase():
while True:
product_name = input("Enter Product name : ")
product_price = int(input("Enter price : "))
quantity = int(input("Quantity : "))
if product_name == 'no' and product_price == quantity == 0:
break
product_list.append(product_name)
price_list.append(product_price)
quantity_list.append(quantity)
def Finalprice():
for i in range(len(price_list)):
final_price.append(price_list[i]*quantity_list[i])
def Invoice():
print(" **** Invoice **** ")
print("SN :", serial, " Date : ", date)
print("Name : ", customer_name)
print("Phone : ", customer_mobile)
for i in range(len(product_list)):
print("Item : ",product_list[i],"|","Quantity : ",quantity_list[i],"|","Price :",quantity_list[i],"*",price_list[i], " = ",final_price[i])
return print("Total amount : ",sum(final_price))
purchase()
Finalprice()
os.system('cls')
Invoice()
print(" **** Thank You! **** ")