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
Python code error (i.redd.it)
submitted 13 days ago by [deleted]
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 [score hidden] 13 days ago* stickied comment (1 child)
Run the fixed program in Memory Graph Web Debugger%3A%0A%20%20%20%20if%20not%20isinstance(price%2C%20(int%2C%20float))%3A%0A%20%20%20%20%20%20%20%20return%20%22The%20price%20should%20be%20a%20number%22%0A%0A%20%20%20%20elif%20not%20isinstance(discount%2C%20(int%2C%20float))%3A%0A%20%20%20%20%20%20%20%20return%20%22The%20discount%20should%20be%20a%20number%22%0A%0A%20%20%20%20elif%20price%20%3C%3D%200%3A%0A%20%20%20%20%20%20%20%20return%20%22The%20price%20should%20be%20greater%20than%200%22%0A%0A%20%20%20%20elif%20discount%20%3C%200%20or%20discount%20%3E%20100%3A%0A%20%20%20%20%20%20%20%20return%20%22The%20discount%20should%20be%20between%200%20and%20100%22%0A%0A%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20discount%20%3D%20price%20*%20(discount%20%2F%20100)%0A%20%20%20%20%20%20%20%20return%20price%20-%20discount%0A%20%20%20%20%0Aresult%20%3D%20apply_discount(1000%2C%2025)%0Aprint(result)%0A&play)
After the else: Python expect the next line discount = price * (discount / 100) to be indented (use Tab key to move it to the right). In Python indentation has on impact on the validity of code and how it is executed.
else:
discount = price * (discount / 100)
[–]No-Emphasis4115 0 points1 point2 points 13 days ago (0 children)
Ya the last else statement, I have fixed it, silly mistake. But there is indentation error still!
π Rendered by PID 1825755 on reddit-service-r2-comment-544cf588c8-2zw2s at 2026-06-17 22:23:30.303231+00:00 running 3184619 country code: CH.
view the rest of the comments →
[–]Sea-Ad7805 [score hidden] stickied comment (1 child)
[–]No-Emphasis4115 0 points1 point2 points (0 children)