-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshop.py
More file actions
371 lines (371 loc) · 9.81 KB
/
Copy pathshop.py
File metadata and controls
371 lines (371 loc) · 9.81 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
{
"cells": [
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import seaborn as sns\n",
"class Product:\n",
" product={\n",
" 'id':[1,2,3,4,5,6,7,8,9,10],\n",
" 'name':['apple','orange','banana','mango','biscuit','chocklates','egg','chicken','soap','icecream'],\n",
" 'quality':['best','normal','best','normal','good','best','normal','best','normal','best'],\n",
" 'price':[100,222,341,334,122,111,233,111,112,111] \n",
" }\n",
"calc={\n",
" 'apple':100,\n",
" 'orange':222,\n",
" 'banana':341,\n",
" 'mango':334,\n",
" 'biscuit':122,\n",
" 'chocklates':111,\n",
" 'egg':233,\n",
" 'chicken':111,\n",
" 'soap':112,\n",
" 'icecream':111\n",
" \n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"new_p=Product.product"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>name</th>\n",
" <th>quality</th>\n",
" <th>price</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>apple</td>\n",
" <td>best</td>\n",
" <td>100</td>\n",
" </tr>\n",
" <tr>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>orange</td>\n",
" <td>normal</td>\n",
" <td>222</td>\n",
" </tr>\n",
" <tr>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>banana</td>\n",
" <td>best</td>\n",
" <td>341</td>\n",
" </tr>\n",
" <tr>\n",
" <td>3</td>\n",
" <td>4</td>\n",
" <td>mango</td>\n",
" <td>normal</td>\n",
" <td>334</td>\n",
" </tr>\n",
" <tr>\n",
" <td>4</td>\n",
" <td>5</td>\n",
" <td>biscuit</td>\n",
" <td>good</td>\n",
" <td>122</td>\n",
" </tr>\n",
" <tr>\n",
" <td>5</td>\n",
" <td>6</td>\n",
" <td>chocklates</td>\n",
" <td>best</td>\n",
" <td>111</td>\n",
" </tr>\n",
" <tr>\n",
" <td>6</td>\n",
" <td>7</td>\n",
" <td>egg</td>\n",
" <td>normal</td>\n",
" <td>233</td>\n",
" </tr>\n",
" <tr>\n",
" <td>7</td>\n",
" <td>8</td>\n",
" <td>chicken</td>\n",
" <td>best</td>\n",
" <td>111</td>\n",
" </tr>\n",
" <tr>\n",
" <td>8</td>\n",
" <td>9</td>\n",
" <td>soap</td>\n",
" <td>normal</td>\n",
" <td>112</td>\n",
" </tr>\n",
" <tr>\n",
" <td>9</td>\n",
" <td>10</td>\n",
" <td>icecream</td>\n",
" <td>best</td>\n",
" <td>111</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" id name quality price\n",
"0 1 apple best 100\n",
"1 2 orange normal 222\n",
"2 3 banana best 341\n",
"3 4 mango normal 334\n",
"4 5 biscuit good 122\n",
"5 6 chocklates best 111\n",
"6 7 egg normal 233\n",
"7 8 chicken best 111\n",
"8 9 soap normal 112\n",
"9 10 icecream best 111"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dataa=pd.DataFrame(new_p)\n",
"dataa\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"enter the number of purcase by customer:5\n",
"enter the product name: apple\n",
"enter the number of product purchases:3\n",
"the single product value 300\n",
"enter the product name: orange\n",
"enter the number of product purchases:2\n",
"the single product value 444\n",
"enter the product name: banana\n",
"enter the number of product purchases:5\n",
"the single product value 1705\n",
"enter the product name: icecream\n",
"enter the number of product purchases:2\n",
"the single product value 222\n",
"enter the product name: soap\n",
"enter the number of product purchases:5\n",
"the single product value 560\n",
"total sum of purchase 3231\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>name</th>\n",
" <th>num_purchase</th>\n",
" <th>price</th>\n",
" <th>grand_total</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>0</td>\n",
" <td>apple</td>\n",
" <td>3</td>\n",
" <td>300</td>\n",
" <td>300</td>\n",
" </tr>\n",
" <tr>\n",
" <td>1</td>\n",
" <td>orange</td>\n",
" <td>2</td>\n",
" <td>444</td>\n",
" <td>744</td>\n",
" </tr>\n",
" <tr>\n",
" <td>2</td>\n",
" <td>banana</td>\n",
" <td>5</td>\n",
" <td>1705</td>\n",
" <td>2449</td>\n",
" </tr>\n",
" <tr>\n",
" <td>3</td>\n",
" <td>icecream</td>\n",
" <td>2</td>\n",
" <td>222</td>\n",
" <td>2671</td>\n",
" </tr>\n",
" <tr>\n",
" <td>4</td>\n",
" <td>soap</td>\n",
" <td>5</td>\n",
" <td>560</td>\n",
" <td>3231</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" name num_purchase price grand_total\n",
"0 apple 3 300 300\n",
"1 orange 2 444 744\n",
"2 banana 5 1705 2449\n",
"3 icecream 2 222 2671\n",
"4 soap 5 560 3231"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"class Inventory(Product):\n",
" summ=0\n",
" name_array=[]\n",
" num_pro=[]\n",
" exact_val=[]\n",
" grand_total=[]\n",
" num=int(input('enter the number of purcase by customer:'))\n",
" for i in range(num):\n",
" pro_name=input(\"enter the product name: \")\n",
" name_array.append(pro_name)\n",
" \n",
" pro_n= int(input('enter the number of product purchases:'))\n",
" num_pro.append(pro_n)\n",
" \n",
" \n",
" in_sum=calc[pro_name]*pro_n\n",
" exact_val.append(in_sum)\n",
" \n",
" print(\"the single product value \",in_sum)\n",
" summ=summ+in_sum\n",
" grand_total.append(summ) \n",
" \n",
" print(\"total sum of purchase\",summ) \n",
" global dicc\n",
" dicc={'name':name_array,\n",
" 'num_purchase':num_pro,\n",
" 'price':exact_val,\n",
" 'grand_total': grand_total }\n",
" \n",
"\n",
"pd.DataFrame(dicc)\n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}