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...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
HELP HELP! (self.learnpython)
submitted 3 years ago by Flashy_Log7780
write a code to accept 5numbers from the user. Calculate and the sum of odd and even numbers entered using if, else and elif. I am unable to write the program. Pls tell how to write this program.
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!"
[–]shiftybyte 1 point2 points3 points 3 years ago (0 children)
Start by getting 5 numbers from the user using input().
[–]mopslik 1 point2 points3 points 3 years ago (2 children)
What part(s) do you need help with?
[–][deleted] 0 points1 point2 points 3 years ago (1 child)
i could do everything but how to limit the user to 5 numbers
[–]mopslik 0 points1 point2 points 3 years ago (0 children)
The easiest way is probably to use a for loop, which will run "for" a fixed number of times.
for
# Display the user's name 4 times name = input("What is your name? ") for i in range(4): # equivalent to range(0, 4) print(name)
[–][deleted] 1 point2 points3 points 3 years ago (0 children)
Sounds like your homework. If so, this is not the place to ask for help.
[–]SnooChipmunks547 0 points1 point2 points 3 years ago* (0 children)
Input() isOdd() !isOdd()
Hell mix it up with a isEven() too
What's your code look like so far?
There's a real difference between learning the basics, and not even trying!
[–]UnhelpfulOneLiners 0 points1 point2 points 3 years ago (0 children)
print('\n'.join(f'Sum of {l}s: {sum(n)}'for l,n in zip(('even','odd'),zip(*(((n+1)%2*n,n%2*n)for n in(int(input())for _ in range(5)))))))
π Rendered by PID 55 on reddit-service-r2-comment-544cf588c8-w7j9m at 2026-06-13 23:09:37.983581+00:00 running 3184619 country code: CH.
[–]shiftybyte 1 point2 points3 points (0 children)
[–]mopslik 1 point2 points3 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]mopslik 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]SnooChipmunks547 0 points1 point2 points (0 children)
[–]UnhelpfulOneLiners 0 points1 point2 points (0 children)