-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathASP_Shop.py
More file actions
60 lines (48 loc) · 1.72 KB
/
ASP_Shop.py
File metadata and controls
60 lines (48 loc) · 1.72 KB
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
51
52
53
54
55
56
57
58
59
60
# importing module
from pandas import *
import csv
amount =5
price =2
with open('names3.csv', 'w', newline='') as csvfile:
fieldnames = ['Size', 'Amount','price','total']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
#writer.writerow({'Size': 'small', 'Amount': amount,'price':price})
while True:
print("welcome to our Asp Shop")
#print("3-Exit")
print("=========================")
# choise= int(input("Enter your choise "))
# mydic = {}
my_dict = {'1-small':5 , '2-medium':10,'3-large':15}
print(my_dict)
choise= int(input("Enter your choise "))
if(choise==1):
amount= int(input("Enter the amount "))
price=(amount*my_dict['1-small'])
print(price)
writer.writerow({'Size': 'small', 'Amount': amount,'price':price})
if(choise==2):
amount= int(input("Enter the amount "))
price=(amount*my_dict['2-medium'])
print(price)
writer.writerow({'Size': 'medium', 'Amount': amount,'price':price})
if(choise==3):
amount= int(input("Enter the amount "))
price=(amount*my_dict['3-large'])
print(price)
writer.writerow({'Size': 'large', 'Amount': amount,'price':price})
if(choise==4):
print("bye")
csvfile.close()
data = read_csv("names3.csv")
# converting column data to list
fc = data['price'].tolist()
print('total', fc)
sum = 0
for x in fc:
sum = sum + x
print(sum)
data = read_csv("names3.csv")
data['tota']=sum
exit()