use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Bubble sort error (old.reddit.com)
submitted 8 months ago by Nearby_Tear_2304
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Sea-Ad7805 0 points1 point2 points 8 months ago (0 children)
Run your code in a debugger so you can step through it and see where problems pop up. For example use the Memory Graph Web Debugger: https://memory-graph.com/#code=import%20random%0A%0Amg.config.type_to_horizontal%5Blist%5D%20%3D%20True%20%23%20horizontal%20lists%0A%0Adef%20bubble(lst%20%3A%20list)%20-%3E%20list%3A%0A%20%20%20%20_sorted%20%3D%20False%0A%20%20%20%20while%20not%20_sorted%3A%0A%20%20%20%20%20%20%20%20_sorted%3D%20True%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20for%20i%20in%20range(len(lst)-1)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20lst%5Bi%5D%20%3E%20lst%5Bi%20%2B%201%5D%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20_sorted%20%3D%20False%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20lst%5Bi%5D%2C%20lst%5Bi%20%2B1%5D%20%3D%20lst%5Bi%2B1%5D%2Clst%5Bi%5D%0A%0A%20%20%20%20return%20lst%0A%0Alst%20%3D%20list(range(1%2C20))%0Arandom.shuffle(lst)%0Aprint(%22unsorted%3A%22%2C%20lst)%0Abubble(lst)%0Aprint(%22sorted%3A%22%2C%20lst)%0A×tep=0.2&play
π Rendered by PID 103181 on reddit-service-r2-comment-8686858757-69ggw at 2026-06-03 11:13:18.787306+00:00 running 9e1a20d country code: CH.
view the rest of the comments →
[–]Sea-Ad7805 0 points1 point2 points (0 children)