-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPython CourseWork Part 04.py
142 lines (114 loc) · 4.33 KB
/
Python CourseWork Part 04.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
Progress = 0 # opening a 0 variable to modify within the loop and calculate the total Progress
Trailer = 0 # opening a 0 variable to modify within the loop and calculate the total module trailer
Retriever = 0 # opening a 0 variable to modify within the loop and calculate the total module Retriever
Exclude = 0 # opening a 0 variable to modify within the loop and calculate the total Exclude
total = 0 # opening a 0 variable to modify eithin loop and calculate total
outcome = 0
outcomes = 0
#creating a empty list
all_credits = []
#creating a dictionary
students_credits = {}
print("-" * 100, "PART 01-PROGRESSION OUTCOME", "-" * 100)
def credits(Pass_MR,Defer_MR,Fail_MR,total):
global outcome
if Pass_MR + Defer_MR + Fail_MR == 120:
if Pass_MR == 120 and Defer_MR == 0 and Fail_MR == 0:
print("Progress")
outcome = 'Progress'
global Progress
Progress += 1
elif Pass_MR == 100 and (Defer_MR in(0, 20))and (Fail_MR in(0, 20)):
print("Progress (module trailer)")
outcome = 'Trailer'
global Trailer
Trailer += 1
elif (Pass_MR in (0, 20, 40, 60, 80)) and (Fail_MR in (0, 20, 40, 60)):
print("Do not progress-module retriever")
outcome = 'Retriever'
global Retriever
Retriever += 1
elif (Pass_MR in (40, 20, 0)) and (Defer_MR in (0, 20, 40)) and (Fail_MR in (80, 100, 120)):
print("Exclude")
outcome = 'Exclude'
global Exclude
Exclude += 1
else:
print('Total incorrect')
valid = True
while valid == True:
while True:
while True:
digit_count = 0
Student_ID = input("Enter student ID : ")
if Student_ID [0].lower() == 'w':
if len(Student_ID) == 8:
for digit in Student_ID[1:]:
if digit.isdigit():
digit_count += 1
else :
print("Invalid ID")
break
break
else:
print("Invaild ID")
else:
print("Invaild ID")
try:
Pass_MR = int(input('\nPlease Enter Your Pass Marks : '))
if (Pass_MR in [0,20,40,60,80,100,120]):
break
else:
print('Out of range')
except ValueError:
print('Integer required')
while True:
try:
Defer_MR = int(input('Please Enter Your Defer marks : '))
if (Defer_MR in [0,20,40,60,80,100,120]):
break
else:
print('Out of range')
except ValueError:
print('Integer required')
while True:
try:
Fail_MR = int(input('Please Enter Your Fail Marks : '))
if (Fail_MR in [0,20,40,60,80,100,120]):
break
else:
print('Out of range')
except ValueError:
print('Integer required')
credits(Pass_MR,Defer_MR,Fail_MR,total)
all_credits.append(f"{outcome} - {Pass_MR} - {Defer_MR} - {Fail_MR}")
for x in range(0, len(all_credits)):
students_credits.update({Student_ID : all_credits[x]})
outcomes += 1
correct= True
while correct == True:
print("\nWould you like to enter another set of data ?")
option = input("Enter 'y' for Continue the programe or 'q' to Quit the programe and view results : ")
if option == "y":
correct = False
elif option == "q":
correct = False
valid = False
else:
print("Plese Enter the Valid Input")
print()
print("-" * 150)
#creating the histrogram section for part 01
print("Histrogram")
print("Progress", Progress, ":", "*" * Progress)
print("Trailer", Trailer, ":", "*" * Trailer)
print("Retriever", Retriever, ":", "*" * Retriever)
print("Exclude", Exclude, ":", "*" * Exclude)
print()
print((Progress + Trailer + Retriever + Exclude), "Outcomes in toatal")
print("-" * 150)
#creating the dictionary part 04
print("-" * 100, "PART 04-DICTIONARY", "-" * 100)
print()
for i in students_credits:
print(i, ":", students_credits[i])