Skip to main content
Practice

coding-quiz-1

---
id: coding-quiz-1
title: Coding Quiz - Implement Bubble Sort
description: Create a function that sorts a list of numbers in ascending order using the bubble sort algorithm.
tags:
- Coding Quiz
- Bubble Sort
- Python
sidebar_position: 4
isPublic: false
---

# Coding Quiz - Implement Bubble Sort

Based on what you've learned so far, implement the `bubble sort` algorithm yourself.

<br />

```python title="Write Your Code"
def solution(numbers):
# Write your code here
return


Constraints


  • numbers is a list containing numbers.

  • The length of the list must be at least 1.




Input/Output Examples

  • Input: [34, 2, 1, 78, 56]

  • Output: [1, 2, 34, 56, 78]


  • Input: [5, 3, 8, 4, 2]

  • Output: [2, 3, 4, 5, 8]

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.