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):
|
for j in range(0, len(marks)-i-1):
|
||||||
if marks[j]>marks[j+1]:
|
if marks[j]>marks[j+1]:
|
||||||
marks[j], marks[j+1] = marks[j+1], marks[j]
|
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():
|
def choose_optn():
|
||||||
|
Loading…
Reference in New Issue
Block a user