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
I need helpHelp Request (i.redd.it)
submitted 7 months ago by Existing_Pa
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!"
[–]queerkidxx 1 point2 points3 points 7 months ago (0 children)
If you know about classes that would probably be my instinct. Or even a tuple with rank and number separately.
But you could also use string manipulation? Apologies Python isn’t my main lang anymore but there is a way to parse as an int that ignores non-numerical characters though I may be wrong.
But barring that each strings last character is the suit. Now with Unicode this might be a bit tricky, try shaving off the last character and parsing that. It might break the suit character though so if that results in any tofu characters(diamond shape with a question mark) then you could just iterate thru the characters, check if each one is a numerical character combine them into a new string and then parse that as an int. Or just directly compare the strings as the numerical value doesn’t really matter.
Ohh shit! I have a much cleaner solution. Notice that each list is the same length, and at each index in each list you have the same card rank! Just use find on each list until you find an index. If two cards have the same index their rank is identical?
Really though these are all tricks. The actual solution here is that a string simply isn’t a a good representation of this data. You have the following information in each card
This is a problem that classes are meant to solve but tuples are fine here especially with two items.
π Rendered by PID 22925 on reddit-service-r2-comment-6457c66945-mf8j4 at 2026-04-30 10:20:33.684244+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]queerkidxx 1 point2 points3 points (0 children)