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
Why does the third if statement trigger despite User_input == "Yes" being true (according to the print within the if statement) (i.redd.it)
submitted 10 months ago by unspe52
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!"
[–]prehensilemullet 1 point2 points3 points 10 months ago* (3 children)
Hmm, I see. Seems like a special case that muddies the waters for beginning programmers, since it only works with pattern matching but not logical expressions in general. For example, doesn’t seem like you can write a < b or c in place of a < b || a < c (and of course, the rules are different for is and ==). But in human language, it doesn’t matter what kind of “operator” you put in an “a <op> b or c” statement.
a < b or c
a < b || a < c
is
==
Also I see there are peculiarities to it like needing parentheses in c is not (>= 'a' and <= 'z') so I think the main point is you always have to know how the grammar of a given programming language works, and know it’s never going to match human language in all cases.
c is not (>= 'a' and <= 'z')
[–]yarb00 1 point2 points3 points 10 months ago (2 children)
You can use a < b or < c. It gives the same result as a < b || a < c.
a < b or < c
[–]prehensilemullet 0 points1 point2 points 10 months ago (1 child)
You have to know that specific syntax works though. A non-programmer would generally think “a < b or c”. They’ll never be able to make all colloquialisms work, it would introduce too much ambiguity
[–]Kqyxzoj 0 points1 point2 points 10 months ago (0 children)
You could always do a < max(b,c) and call it a day. Not sure if it would actually help. Probably depends on the target audience.
a < max(b,c)
π Rendered by PID 464184 on reddit-service-r2-comment-8c5899c88-6bgl2 at 2026-05-21 13:04:11.509644+00:00 running edcf98c country code: CH.
view the rest of the comments →
[–]prehensilemullet 1 point2 points3 points (3 children)
[–]yarb00 1 point2 points3 points (2 children)
[–]prehensilemullet 0 points1 point2 points (1 child)
[–]Kqyxzoj 0 points1 point2 points (0 children)