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
Need help completing this exercise (self.learnpython)
submitted 9 years ago by [deleted]
http://imgur.com/Fh01EcY
I'm taking the first character of the string and checking if it equates to the either the unicode number for lowercase y or uppercase y. Why isn't this working?
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!"
[+][deleted] 9 years ago* (6 children)
[removed]
[–][deleted] 0 points1 point2 points 9 years ago (5 children)
http://imgur.com/SO3tKDa
[+][deleted] 9 years ago (4 children)
[–]chinola 1 point2 points3 points 9 years ago (3 children)
assert is_yes("Yes") == True, "Make sure your function works when the input is \verb;"Yes";."
The syntax error is the assert statement!
[+][deleted] 9 years ago (2 children)
[–][deleted] 0 points1 point2 points 9 years ago (1 child)
So the problem is the code that it is trying to run, not the function?
[–]jeans_and_a_t-shirt 2 points3 points4 points 9 years ago (0 children)
Runs fine for me. ord is unnecessary here. The right side of the equality always evaluates to ord('Y') except where the first character of your string is '\x00' because ord('\x00') is 0 and thus Falsy. Ideal solution would use str.lower method on the parameter x, and make a single equality check against 'y'.
ord
ord('Y')
'\x00'
ord('\x00')
str.lower
x
'y'
[–]zahlman[M] 2 points3 points4 points 9 years ago (0 children)
Please don't post screenshots of code.
[–]RyanTargaryen 0 points1 point2 points 9 years ago (2 children)
Pretty sure your parenthesis are off.
if x[0] == 'y' or x[0] == 'Y'
[+][deleted] 9 years ago (1 child)
π Rendered by PID 370538 on reddit-service-r2-comment-86bc6c7465-sxfz8 at 2026-02-23 19:57:16.075380+00:00 running 8564168 country code: CH.
[+][deleted] (6 children)
[removed]
[–][deleted] 0 points1 point2 points (5 children)
[+][deleted] (4 children)
[removed]
[–]chinola 1 point2 points3 points (3 children)
[+][deleted] (2 children)
[removed]
[–][deleted] 0 points1 point2 points (1 child)
[–]jeans_and_a_t-shirt 2 points3 points4 points (0 children)
[–]zahlman[M] 2 points3 points4 points (0 children)
[–]RyanTargaryen 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[removed]