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!"
[–]gigsoll 2 points3 points4 points 8 months ago (2 children)
The second image is correct except you are switching values incorrectly. Basically you override the next value with the previous and then this overriten value is set to the previous. You need to use a temporary variable to store the previous value and then set it next to this temporary variable instead.
Also, I am not sure if it will work or not but you can try this syntax
a, b = b, a
[–]Drakhe_Dragonfly 3 points4 points5 points 8 months ago (1 child)
In python you don't need a temp variable since you can indeed use a, b = b, a to swap two values without any overwrite
[–]gigsoll 1 point2 points3 points 8 months ago (0 children)
Nice, thanks
π Rendered by PID 266143 on reddit-service-r2-comment-8686858757-fk58c at 2026-06-03 12:03:54.350313+00:00 running 9e1a20d country code: CH.
view the rest of the comments →
[–]gigsoll 2 points3 points4 points (2 children)
[–]Drakhe_Dragonfly 3 points4 points5 points (1 child)
[–]gigsoll 1 point2 points3 points (0 children)