Skip to content

5 #11

Description

@legend17-dot

Read 6 subject marks
marks = []
print("Enter marks for 6 subjects:")
for i in range(6):
mark = int(input(f"Subject {i+1}: "))
marks.append(mark)

Bubble Sort (Descending Order)

n = len(marks)
for i in range(n - 1):
for j in range(n - i - 1):
if marks[j] < marks[j + 1]: # For highest to lowest

Swap

marks[j], marks[j + 1] = marks[j + 1], marks[j]

Display sorted marks

print("\nMarks from Highest to Lowest:")
for mark in marks:
print(mark)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions