-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMarksheet.py
149 lines (146 loc) · 7.73 KB
/
Marksheet.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
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
from datetime import datetime
year=datetime.now().year
date=datetime.now().strftime("%d-%m-%Y")
while True:
while True:
Name=input("\nType your name:")
if len(Name)==0:
print('''"You made mistake while filling name section"''')
else:
break
while True:
F_Name=input("\nType father name:")
if len(F_Name)==0:
print('''"You made mistake while filling f.name section"''')
else:
break
while True:
School=input("\nType your school name:")
if len(School)==0:
print('''"You made mistake while filling school section"''')
else:
break
while True:
Group=input("\nType your group eg.Science,Arts:")
if len(Group)==0:
print('''"You made mistake while filling group section"''')
else:
break
while True:
Board=input("\nType name of your board:")
if len(Board)==0:
print('''"You made mistake while filling board section"''')
else:
break
while True:
try:
num1 = int(input('\nEnter number of total subjects:'))
except ValueError:
print('''\n"Please enter only number"''')
else:
break
l_Subjects=[]
l_T_Marks=[]
l_Marks=[]
S_numbers=["first","second","third","fourth","fifth","sixth","seventh","eighth","ninth","tenth","eleventh","twelth","thirteenth","fourteenth","fifteenth","sixteenth","eighteenth","nineteenth","twentieth"]
for i in range(num1):
print(f'''\n"For the {S_numbers.pop(0)} subject"\n''')
Subjects=input("Type subject name:")
l_Subjects.append(Subjects)
while True:
try:
T_Marks= int(input(f'Enter total marks for {Subjects}:'))
l_T_Marks.append(T_Marks)
while True:
try:
Marks = int(input('Enter obtained marks:'))
except ValueError:
print('''\n"Please enter only number"''')
if Marks>T_Marks:
print('''\n"Please insert correct marks"''')
else:
l_Marks.append(Marks)
break
except ValueError:
print('''\n"Please enter only number"''')
else:
break
print('''\n\n "Here is your Marksheet"\n\n''')
print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
print(f"{'§': <80}§")
print(f"{'§': <80}§")
print(f"§ {Board.title(): <56}§")
print(f"{'§': <80}§")
print(f"{'§': <80}§")
print(f"§ Examination Annual {year: <51}§")
print(f"{'§': <80}§")
print(f"§ Name {Name.title(): <58}§")
print(f"{'§': <80}§")
print(f"§ F.Name {F_Name.title(): <58}§")
print(f"{'§': <80}§")
print(f"§ School/Private {School.title(): <58}§")
print(f"{'§': <80}§")
print(f"§ Group {Group.title(): <58}§")
print(f"{'§': <80}§")
print("§ _________________________________________________________________________ §")
print("§ | | §")
print("§ | Subjects | §")
print("§ |_________________________________________________________________________| §")
print("§ | Component | Marks | §")
print("§ |_____________________________________|___________________________________| §")
l_T_Marks1=list(l_T_Marks)
l_Marks1=l_Marks.copy()
l_Subjects1=l_Subjects.copy()
for i in list(l_Marks):
print(f"§ | {(l_Subjects.pop(0)).title(): <22} | {l_Marks.pop(0):>4}/{l_T_Marks.pop(0): <18}| §")
print(f"§ |_____________________________________|___________________________________| §")
Sum_Marks=(sum(l_Marks1))
Sum_T_Marks=(sum(l_T_Marks1))
Percentage=(Sum_Marks/Sum_T_Marks)*100
if(Percentage>=80):
Grade='A+'
elif(Percentage>=70 and Percentage<80):
Grade='A'
elif(Percentage>=60 and Percentage<70):
Grade='B'
elif(Percentage>=50 and Percentage<60):
Grade='C'
elif(Percentage>=40 and Percentage<50):
Grade='D'
else:
Failed=('''"Sorry! You have failed the exam." §''')
Grade='F'
print(f"{'§': <80}§")
print(f"{'§': <80}§")
print(f"§ Grand Total {Sum_Marks:>4} out of {Sum_T_Marks:<23}§")
print(f"{'§': <80}§")
print("§ _______ §")
print("§ | | §")
print(f"§ Grade | {Grade.title(): <4}| §")
print("§ |_______| §")
if Grade=='F':
print(f"{'§': <80}§")
print(f"§ {Failed: <5}")
print(f"{'§': <80}§")
print("§ Waseem Munir §")
print("§ _________________________ §")
print("§ Controller of Examination §")
print(f"{'§': <80}§")
print(f"§ Dated:{date: <72}§")
print(f"{'§': <80}§")
print(f"{'§': <80}§")
print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
while True:
Repeat=input("\nDo you want to repeat?\n\nYes or No:")
Repeat=Repeat.lower()
if Repeat not in ["yes","y","no","n"]:
print('''"\nPlease select correct option"''')
else:
break
if Repeat in ["yes","y"]:
continue
else:
if Repeat in ["no","n"]:
print("\n-----Thank you for using-----")
input()
break