updated top 5 function to only show top 5 scores instead of the whole list in descending order. requires minimum 6 elements in the list.
This commit is contained in:
parent
ed996705db
commit
79a69ad179
@ -32,7 +32,7 @@ def top5():
|
||||
for j in range(0, len(marks)-i-1):
|
||||
if marks[j]>marks[j+1]:
|
||||
marks[j], marks[j+1] = marks[j+1], marks[j]
|
||||
print("Top 5 marks using bubble sorting:\t", marks[::-1])
|
||||
print("Top 5 marks using bubble sorting:\t", marks[len(marks):len(marks)-6:-1]) # Requires 6 elements in the list.
|
||||
|
||||
|
||||
def choose_optn():
|
||||
@ -55,7 +55,7 @@ def choose_optn():
|
||||
top5()
|
||||
elif optn==5:
|
||||
print("## DESIGNED AND ENGINEERED BY KSHITIJ\n## END OF CODE")
|
||||
quit()
|
||||
quit()
|
||||
else:
|
||||
print("\nPlease choose a valid option (1-5).\n")
|
||||
choose_optn()
|
||||
|
Loading…
Reference in New Issue
Block a user