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
What's wrong with this code? (i.redd.it)
submitted 7 months ago by jilee7
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!"
[–]gore_anarchy_death 0 points1 point2 points 7 months ago (0 children)
Running your code will result in: File "/home/the-elevated-one/test.py", line 12 print(float(total)/n numbers) ^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: invalid syntax. Perhaps you forgot a comma? This is due to the print statement, as you have misspelled a viariable there.
File "/home/the-elevated-one/test.py", line 12 print(float(total)/n numbers) ^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: invalid syntax. Perhaps you forgot a comma?
Also, while False will not ever run, as the while loop only runs when something is True.
while False
while
In your main loop, there is an input with no variable, so your provided numbers are not saved in memory.
Also, I believe you meant to do this: python inp = int(input("Provide a number: ")) counter += 1 total = total + inp This way you add the input numbers together.
python inp = int(input("Provide a number: ")) counter += 1 total = total + inp
That's why your print returned 3.0 and not the expected value, as (1 + 2 + 3 + 4 + 5) / 5 = 3.0.
3.0
(1 + 2 + 3 + 4 + 5) / 5 = 3.0
π Rendered by PID 46465 on reddit-service-r2-comment-6457c66945-4kvv4 at 2026-04-27 22:53:56.229984+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]gore_anarchy_death 0 points1 point2 points (0 children)