Discussions Events Study Material Jobs
Sort a List Manual Bubble Sort using Loops in Python - Uniwaly

Explore Diverse Conversations

Sort a List Manual Bubble Sort using Loops in Python

Posted By: UmairMehmood Published On: 13 June 2025 At: 12:28 PM

Sort a list of numbers in ascending order using a loop (no built-in sort)
numbers = [5, 2, 9, 1, 7, 3]
n = len(numbers)

for i in range(n):
    for j in range(0, n - i - 1):
        if numbers[j] > numbers[j + 1]:
            numbers[j], numbers[j + 1] = numbers[j + 1], numbers[j]
print("Sorted list in ascending order:", numbers)


Tags:

python bubble sort in python bubble sort
Login to like

Posted By:

Author Profile

UmairMehmood

11 days ago

Join the conversation!

Login to Comment

Discover More Articles

Pakistan Bait ul Mal Jobs 2025 - Apply Now

Social Mobilizer - The Urban Unit Jobs 2025

Al Barik Bank Jobs 2025 in Pakistan - Apply Now

INSPECTORATE OF MINES, PUNJAB, MINES & MINERALS DEPARTMENT 2025 - 14/2025

LECTURER (ENGLISH) PPSC Jobs 14/2025 in INSPECTORATE OF MINES, PUNJAB, MINES & MINERALS DEPARTMENT

Kazakhstan Government Scholarship - How to Apply ? - Complete Detail

International Scholarship without IELTS 2025

Basic Calculator with if elif Using Python

Critically discuss Quality and Access as to two problems in higher education. Suggest some ways to address these problems.

فلم پی کے میں دکھایا گیا ایک سین حقیقت میں تبدیل