-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPart - 03 (Vertical Histogram).py
121 lines (81 loc) · 2.61 KB
/
Part - 03 (Vertical Histogram).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
# case 03
def marking_process():
if pass_marks == 120:
return 'p'
elif pass_marks == 100:
return 't'
elif fail_marks >= 80:
return 'e'
else:
return 'm'
def validation(mark_p, mark_d, mark_f):
if mark_p + mark_d + mark_f == 120:
if mark_p % 20 != 0 or mark_d % 20 != 0 or mark_f % 20 != 0:
print('Range error')
return False
else:
return True
else:
print('Total incorrect')
return False
def is_q(marks):
if marks == 'q':
return True
return False
#histrogram
def histrogram():
max_value = max(progress, module_trailer, module_retriever, exclude)
print('Progress\tTrailing\tRetriever\tExclude')
for i in range (max_value):
if i < progress:
print(' *\t\t ',end = '')
else:
print(' \t\t ',end = '')
if i < module_trailer:
print('*\t\t ',end = '')
else:
print(' \t\t ',end = '')
if i < module_retriever:
print('*\t\t ',end = '')
else:
print(' \t\t ',end = '')
if i < exclude:
print('*')
else:
print(' ')
print(progress + module_trailer + module_retriever + exclude,'outcomes in total')
progress = 0
module_trailer = 0
module_retriever = 0
exclude = 0
while True:
try:
pass_marks = input('Enter your pass credit ')
if is_q(pass_marks):
break
pass_marks = int(pass_marks)
defer_marks = input('Enter your defer credit ')
if is_q(defer_marks):
break
defer_marks = int(defer_marks)
fail_marks = input('Enter your fail credit ')
if is_q(fail_marks):
break
fail_marks = int(fail_marks)
except ValueError:
print('Integers required')
continue
if validation(pass_marks, defer_marks, fail_marks):
if marking_process() == 'p':
progress += 1
print('Progression Outcome :', 'Progress')
elif marking_process() == 't':
module_trailer += 1
print('Progression Outcome :', 'Progress – module trailer')
elif marking_process() == 'e':
module_retriever += 1
print('Progression Outcome :', 'Exclude')
elif marking_process() == 'm':
exclude += 1
print('Progression Outcome :', 'Do not progress – module retriever')
histrogram()