1
+ from reportlab .platypus import SimpleDocTemplate , Table , Paragraph , TableStyle
2
+ from reportlab .lib import colors
3
+ from reportlab .lib .pagesizes import A4
4
+ from reportlab .lib .styles import getSampleStyleSheet
5
+ from datetime import datetime
6
+
7
+ def store_products ():
8
+ print ('=====> WELCOME TO MY-SCHOOL <=====' )
9
+
10
+ default_courses = [
11
+ {
12
+ 'Course' : 'Full Stack Web Application Development' ,
13
+ 'Duration' : '6 Months' ,
14
+ 'Access' : 'Life Time' ,
15
+ 'Price' : 2999
16
+ },
17
+
18
+ {
19
+ 'Course' : 'Django Tutorials for Beginners' ,
20
+ 'Duration' : '2 Months' ,
21
+ 'Access' : 'Life Time' ,
22
+ 'Price' : 'Free'
23
+ },
24
+
25
+ {
26
+ 'Course' : 'AI & Machine Learning Batch Live' ,
27
+ 'Duration' : '1 Year' ,
28
+ 'Access' : 'Life Time' ,
29
+ 'Price' : 10000
30
+ },
31
+
32
+ {
33
+ 'Course' : 'Data Science Complete Course' ,
34
+ 'Duration' : '6 Months' ,
35
+ 'Access' : 'Life Time' ,
36
+ 'Price' : 8000
37
+ }
38
+ ]
39
+
40
+ for i , data in enumerate (default_courses , start = 0 ):
41
+ print (f'--> Course : { i } ' )
42
+ print (f'Course Name : { data ['Course' ]} \n Duration : { data ['Duration' ]} \n Access : { data ['Access' ]} \n Price : { data ['Price' ]} ' )
43
+ print ('---------------------------------------------------------' )
44
+
45
+
46
+ templete = [
47
+ ['Date' , 'Name' , 'Duration' , 'Access' , 'Price' ]
48
+
49
+ ]
50
+
51
+ course_index = - 1
52
+
53
+ parchasing = True
54
+
55
+ while (parchasing ):
56
+ buy_course = int (input ("Which Course Do you wan to Buy (0, 1, 2....) : " ))
57
+ if (buy_course > len (default_courses )):
58
+ print ("Course Index Not Exist to Buy !!" )
59
+ else :
60
+ course = default_courses [buy_course ]
61
+ current_date = datetime .now ()
62
+ formated_time = current_date .strftime ('%d/%m/%Y' )
63
+ buy_date = [
64
+ {
65
+ 'date' : formated_time ,
66
+ }
67
+ ]
68
+ date = buy_date [0 ]
69
+
70
+ templete .append ([
71
+ date ['date' ],
72
+ course ['Course' ],
73
+ course ['Duration' ],
74
+ course ['Access' ],
75
+ course ['Price' ]
76
+ ])
77
+
78
+ for row in templete :
79
+ print (row )
80
+ exit = input ("Do you want to exit (0 - exit) : " )
81
+ if (exit == 'exit' or exit == '0' ):
82
+ parchasing = False
83
+
84
+
85
+
86
+
87
+ store_products ()
0 commit comments