Exercises Python logo
Exercises Python
Course Practice Editor Get started free
  1. Python course
  2. Arrays
  3. Bubble sort
23 Arrays
Fundamentals concepts
  • Lists: Python's arrays
  • Adding, removing and changing elements
  • Reading data into a list and looping over it
  • Searching, filtering and calculating with lists
  • Two-dimensional lists (matrices)
  • Sorting lists and bubble sort
  • Menu programs, statistics and common mistakes
  • Advanced slicing and sorting
  • List aliases and copies
Practice exercises
  • Reverse order array
  • Search an array of integers
  • Search even numbers
  • Search positive and negative numbers
  • Banner command on Unix
  • Bubble sort
  • Two-dimensional array
  • Two-dimensional array of chars
  • Mathematical statistics
  • On-screen circumference
  • Rotate a list
  • Remove duplicates keeping the order
  • Merge two sorted lists
  • Sort by several criteria
Arrays · 15 / 23 Exercise Medium

Bubble sort

Objective

Create a Python program that prompts the user for 10 integers and sorts them using the bubble sort algorithm.

Input
7
8
6
2
3
2
4
1
8
4
Output
1 2 2 3 4 4 6 7 8 8

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise
← PreviousBanner command on Unix Next →Two-dimensional array
Exercises Python logo
Exercises Python

Learn Python by solving practical exercises, free and right in your browser.

Get it on Google Play

Learn

  • Home
  • Course
  • Practice
  • Editor

More

  • Features
  • Contact

Account

  • Log in
  • Sign up

Legal

  • Privacy policy
  • Cookies policy
  • Terms and conditions
  • Cookie settings
  • Sitemap

© 2026. Made with 💙 by Jaracoder.

English
  • Español

We use necessary cookies to keep your session. With your consent we also use cookies for advertising and analytics, which keep the course free and help us improve it. Cookies policy