Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
8
\$\begingroup\$You can save a byte by removing the space between int(x) and for in your list comp.\$\endgroup\$
\$\begingroup\$@ValueInk Sadly, that will produce 31th. Another way I thought of breaking it down was 'th' if not 0<b%10<4 or 10<b<14 but it didn't save any bytes.\$\endgroup\$
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
complete the sentence: my question is about...
use tags that describe things or concepts that are essential, not incidental to your question
int(x)andforin your list comp. \$\endgroup\$(('st','nd','rd')[b%10-1]if b<4 or 20<b<24 else'th')instead of your current conditional for -3 bytes. \$\endgroup\$(3<b<21)+(23<b<31)for -1 byte. Try it online! \$\endgroup\$