Skip to content

Commit 289669f

Browse files
committed
Update main.py
1 parent 682515e commit 289669f

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

classes/main.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ def menu():
1515
print('+-------------------------------------+')
1616
print('|--- *Page Replacement Simulation* ---|')
1717
print('+-------------------------------------+\n')
18-
print("[1] FIFO")
19-
print("[2] LRU")
20-
print("[3] LFU")
21-
print("[4] Optimal")
18+
print("[1] FIFO - First In First Out")
19+
print("[2] LRU - Least Recently Used")
20+
print("[3] LFU - Least Frequently Used")
21+
print("[4] Optimal\n")
2222
print("[0] Exit")
2323
print()
2424

@@ -48,6 +48,7 @@ def main():
4848
}
4949

5050
while True:
51+
clear()
5152
menu()
5253
choice = input("Enter choice: ")
5354
print()
@@ -59,12 +60,18 @@ def main():
5960

6061
algorithm = algorithms.get(choice)
6162
if algorithm:
62-
clear()
63-
execute_algorithm(algorithm)
63+
try:
64+
clear()
65+
execute_algorithm(algorithm)
66+
input("\nPress Enter to return to the menu...")
67+
except Exception as e:
68+
clear()
69+
print(f"An error occurred: {str(e)}")
70+
input("\nPress Enter to continue...")
6471
else:
6572
clear()
66-
print("Invalid input. Please try again.")
67-
print()
73+
print("Invalid input. Please choose a valid option.")
74+
input("\nPress Enter to continue...")
6875

6976

7077
if __name__ == "__main__":

0 commit comments

Comments
 (0)