-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCW1.py
More file actions
72 lines (65 loc) · 2.68 KB
/
Copy pathCW1.py
File metadata and controls
72 lines (65 loc) · 2.68 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
# I declare that my work contains no examples of misconduct, such as plagiarism, or collusion.
# Any code taken from other sources is referenced within my code solution.
# Student ID: W1761197
# Date: 2019/11/29
fail=0
passes=0
defer=0
print("\n~~~~~~~~~~~~~~~Welcome to student version~~~~~~~~~~~~~~~\n")
def start():
global selection
while True:
selection=input("Press 'S' to start the progarm.\nPress 'Q' to execute the program.\n")
if selection=='s' or selection=='S':
inputs()
elif selection=='q' or selection=="Q":
execute()
else:
print("\n~~~~~~~~~~Invalid selection~~~~~~~~~~\n")
continue
def inputs():
global fail,passes,defer
try:
passes=int(input("Enter your passed credits:"))
checker(passes) #checker functaion has a parameter and it assign to vallue.
fail=int(input("Enter your failed credits:"))
checker(fail)
defer=int(input("Enter your defer credits:"))
checker(defer)
except:
print("\n~~~~~~~~~~~~~~~Invalid input,integers required~~~~~~~~~~~~~~~\n")
inputs()
logic()
def checker(value):#check the conditions,if pass or fail or defer not in a range and these inputs not modulus by 20,if value print range error and restart the program.
if value>120 or value<0 or value%20!=0:
print("\n~~~~~~~~~~~~~~~Range error~~~~~~~~~~~~~~~\n")
inputs()
def logic():
global fail,passes,defer
if passes+fail+defer==120:
if passes<=40 and fail>=80:
print("\n.....Your progression outcome is Excluded.....\n")
elif passes==120:
print("\n.....Your progression outcome is progress.....\n")
elif passes==100:
print("\n.....Your progression outcome is Do not progress Module trailer.....\n")
elif passes<=80 and fail<=60:
print("\n.....Your progression outcome is Do not progress Module retriever.....\n")
else:
print("\n~~~~~~~~Total incorrect~~~~~~~~\n")
restart()
def restart():#restart the program
try:
select=int(input("<.....Enter number 1 for you want to check another progrssion.....>\n<.....Enter number 2 for Exit the program.....>\n"))
if select==1:
inputs()
elif select==2:
execute()
except:
print("Invalid selection")
restart()
def execute():
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print("~~~~~~~~~~~~~~Your program is now executed~~~~~~~~~~~~~~")
exit()
start() #call the function for the start the program.