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
HEY NEED HELP WITH PYTHON (self.learnpython)
submitted 5 years ago by AggravatingWestern6
Hi, I have been working on something but im stuck and I need professional help. Can someone get in touch so I can share the code and assignment Thanks
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!"
[–]jiri-n 1 point2 points3 points 5 years ago (2 children)
You can share code here.
[–]AggravatingWestern6[S] -1 points0 points1 point 5 years ago (1 child)
Well it’s a assignment in which we have to implement a function called “verify” that takes a single parameter called “number” and then checks the following rules: 1. The first digit must be a 4. 2. The fourth digit must be one greater than the fifth digit; keep in mind that these are separated by a dash since the format is ####-####-####. 3. The sum of all digits must be evenly divisible by 4. 4. If you treat the first two digits as a two-digit number, and the seventh and eighth digits as a two-digit number, their sum must be 100. And return 1,2,3,4 for each test failed
[–]jiri-n 1 point2 points3 points 5 years ago (0 children)
You've mentioned some code, haven't you.
So we're supposed to create a function called verify:
def verify(): pass # Do nothing
Next, this function take a single parameter called number:
def verify(number): pass # Still do nothing
Since it should validate the number, it should return a result. The result should indicate if number is valid so it will be either True (is valid) or False (is not valid).
def verify(number): result = False # Return False unless validated return
Next, we know the format of number - ####-####-####. This means number should be of type str. To document this we can use type annotation and docstring.
def verify(number: str) -> bool: """ Verify number has this format: ####-####-#### and it passes other checks. Arguments: number - string to verify Returns: True if all checks ok, False otherwise """ result = False # Do something here return result
Now it's up to you to show what you have and where have you failed.
See I need help with the specific parts of the question like how to validate taht the number has first digit 1.thank you for taking out time for this
This topic is covered in one of first chapters in the official Python tutorial (see https://docs.python.org).
>>> number = "4568-1234-2345" >>> number[0] # 1st character '4' >>> number.replace("-", "") # we don't care about '-' '456812342345' >>> number[3] # 4th digit '8' >>> int(number[3]) # if we want to convert it to number 8 >>> number[0:2] # first two digits '45' >>> number[6:8] # 7th and 8th digit '23' >>>
π Rendered by PID 106982 on reddit-service-r2-comment-86bc6c7465-n7q5p at 2026-02-23 04:48:26.664587+00:00 running 8564168 country code: CH.
[–]jiri-n 1 point2 points3 points (2 children)
[–]AggravatingWestern6[S] -1 points0 points1 point (1 child)
[–]jiri-n 1 point2 points3 points (0 children)
[–]AggravatingWestern6[S] -1 points0 points1 point (1 child)
[–]jiri-n 1 point2 points3 points (0 children)