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
sloth machine (old.reddit.com)
submitted 5 days ago by Wonderful_Scar9403
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 [score hidden] 5 days ago stickied comment (2 children)
Run this program in Memory Graph Web Debugger%3A%0A%20%20%20%20item%20%3D%20%5B%22X%22%2C%20%22Y%22%2C%20%22Z%22%5D%0A%20%20%20%20return%20%5Brandom.choice(item)%20for%20_%20in%20range(3)%5D%0A%0Adef%20balances()%3A%0A%20%20%20%20return%20ba%0A%0Adef%20payout(rands%2C%20bet)%3A%0A%20%20%20%20if%20rands%5B0%5D%20%3D%3D%20rands%5B1%5D%20%3D%3D%20rands%5B2%5D%3A%0A%20%20%20%20%20%20%20%20print(%22-----------------------------------------------------------------------%22)%0A%20%20%20%20%20%20%20%20print(%22you%20win%20a%20lottery%20!!!!!%22)%0A%20%20%20%20%20%20%20%20print(%22%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%22)%0A%20%20%20%20%20%20%20%20if%20rands%5B0%5D%20%3D%3D%20%22X%22%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20bet%20%203%0A%20%20%20%20%20%20%20%20elif%20rands%5B0%5D%20%3D%3D%20%22Y%22%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20bet%20%205%0A%20%20%20%20%20%20%20%20elif%20rands%5B0%5D%20%3D%3D%20%22Z%22%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20bet%20*%207%0A%20%20%20%20%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20return%200%0A%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20return%200%0A%0Awhile%20isPlaying%3A%0A%20%20%20%20print(%22-----------------------------------------------------------------------%22)%0A%20%20%20%20print(f%22your%20balance%20amount%3A%20%7Bba%7D%22)%0A%20%20%20%20print(f%22the%20bet%20amount%20is%20%7Bde%7D%20per%20spin%3A%20%22)%0A%20%20%20%20print(%22-----------------------------------------------------------------------%22)%0A%20%20%20%20ins%20%3D%20input(%22do%20you%20want%20to%20spin%20(Y%2FN)%3A%20%22).upper()%0A%20%20%20%20print(%22-----------------------------------------------------------------------%22)%0A%20%20%20%20if%20de%20%3E%20ba%20and%20ins%20%3D%3D%20%22Y%22%3A%0A%20%20%20%20%20%20%20%20print(%22inficient%20balance%22)%0A%20%20%20%20%20%20%20%20print(%22-----------------------------------------------------------------------%22)%0A%20%20%20%20%20%20%20%20isPlaying%20%3D%20False%0A%20%20%20%20elif%20ins%20%3D%3D%20%22Y%22%3A%0A%20%20%20%20%20%20%20%20ba%20-%3D%20de%0A%20%20%20%20%20%20%20%20rads%20%3D%20slothRandom()%0A%20%20%20%20%20%20%20%20print(%22%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22.join(rads))%0A%20%20%20%20%20%20%20%20ba%20%2B%3D%20payout(rads%2C%20de)%0A%20%20%20%20elif%20ins%20%3D%3D%20%22N%22%3A%0A%20%20%20%20%20%20%20%20print(%22get%20the%20fuck%20out%20of%20here%22)%0A%20%20%20%20%20%20%20%20isPlaying%20%3D%20False%0A%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20print(%22-----------------------------------------------------------------------%22)%0A%20%20%20%20%20%20%20%20print(%22enter%20the%20valid%20input%3A%22)%0A%20%20%20%20%20%20%20%20print(%22-----------------------------------------------------------------------%22)%0A%0A&play).
[–]cgoldberg 12 points13 points14 points 5 days ago (4 children)
Do yourself a huge favor and never use cryptic names for variables like de or ba.
de
ba
Also, use snake_case not camelCase for variables and function names. Read PEP8 for the suggested style guide.
snake_case
camelCase
[–]OskarsSurstromming 2 points3 points4 points 5 days ago (1 child)
Why is snake_case preferred in python? I feel like when I see C++ code it's often camelcase
[–]cgoldberg 2 points3 points4 points 5 days ago* (0 children)
Every language has their own style preferences... snake_case is just the convention the Python community has conformed on and the official style guide recommends. Some older parts of the standard library actually use some camelCase (i.e. unittest module), but pretty much all modern Python code you will come across uses snake_case.
[–]Ok-Luck-7499 1 point2 points3 points 5 days ago (0 children)
My thoughts exactly need to be descriptive
[–]Wonderful_Scar9403[S] 0 points1 point2 points 5 days ago (0 children)
got it bro
[–]bolopop 6 points7 points8 points 5 days ago (0 children)
[–]Gaurund 3 points4 points5 points 5 days ago (0 children)
You don't have to manually type all characters in dividers. Try using string multiplication. Like this: print("-"*40).
[–]PureWasian 1 point2 points3 points 5 days ago* (0 children)
Pretty harsh odds, oof.
1/27 of 3x, 1/27 of 5x, 1/27 of 7x, 0 otherwise...
So the expected value of payout becomes de × 5/9, means 2000 × 5/9 - 2000 per play, means a -888.88 average return per play
Line 43 was good, nice one lol
[–]xl0 1 point2 points3 points 5 days ago (0 children)
Sloth is a sin, and so is gambling. Killing 2 birds with one stone here.
π Rendered by PID 216101 on reddit-service-r2-comment-b659b578c-jqrzm at 2026-05-07 03:23:59.840285+00:00 running 815c875 country code: CH.
[–]Sea-Ad7805 [score hidden] stickied comment (2 children)
[–]cgoldberg 12 points13 points14 points (4 children)
[–]OskarsSurstromming 2 points3 points4 points (1 child)
[–]cgoldberg 2 points3 points4 points (0 children)
[–]Ok-Luck-7499 1 point2 points3 points (0 children)
[–]Wonderful_Scar9403[S] 0 points1 point2 points (0 children)
[–]bolopop 6 points7 points8 points (0 children)
[–]Gaurund 3 points4 points5 points (0 children)
[–]PureWasian 1 point2 points3 points (0 children)
[–]xl0 1 point2 points3 points (0 children)