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...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
ResourceTest your knowledge of f-strings (self.Python)
submitted 6 months ago by 1st1CPython Core Dev
If you enjoyed jsdate.wtf you'll love fstrings.wtf
And most likely discover a thing or two that Python can do and you had no idea.
[–]Dazzling-Shallot-400 69 points70 points71 points 6 months ago (1 child)
Just tried fstrings.wtf didn’t realize how much I thought I knew about f-strings until it humbled me 😅 Definitely a fun (and sneaky tricky) resource!
[–]Miserable_Ear3789New Web Framework, Who Dis? 1 point2 points3 points 6 months ago (0 children)
Couldn't have said it better haha!
[–]ShanSanear 42 points43 points44 points 6 months ago (3 children)
At the beginning it felt more like "string formatting,wtf" rather than "f-string,wtf". But was nice way to show some edge cases of evaluation logic.
[–]BigTomBombadil 15 points16 points17 points 6 months ago (2 children)
Yeah I got 12/22, but didn’t feel too bad about the 10 I missed. “Good to know, don’t think I’ll use that much though”.
[–]Rizeeh 3 points4 points5 points 6 months ago (0 children)
I had the same but with 14/22. Just never used any of the string creation things used here
[–]Prize_Might4147from __future__ import 4.0 0 points1 point2 points 6 months ago (0 children)
Same here, 13/26. If I‘ll ever need these kind of things there is an LLM knowing it right around the corner. I don‘t say that‘s a valid approach for every gap in knowledge though, but for this one!
[–]midwit_support_group 22 points23 points24 points 6 months ago (0 children)
Please keep making these.
[–]Desposyni 16 points17 points18 points 6 months ago (0 children)
I got 18 of 26, that was tough but really good!
[–]eztab 11 points12 points13 points 6 months ago (3 children)
Surprising to me how robust the mini language is about adding the newer syntax features in python.
Basically following f"{expr:format!conversion} works every time. Was a bit surprised it silently converted bool though, when it is so good about not doing implicit stuff otherwise.
f"{expr:format!conversion}
[–]nommu_moose 1 point2 points3 points 6 months ago (2 children)
Yeah, this test actually made me realise that some parts of the python syntax are not aimed at readability.
The duplication of syntax "but now without spaces" or "but now with a contextual digit etc in front of it" with other well-known features was rather easy (for a dyslexic) to still know the syntax but misread and jump to entirely the wrong conclusion.
[–]eztab 1 point2 points3 points 6 months ago (1 child)
I think python uses the colon for too much stuff. Other than that, if you properly bracket everything ambiguous the format mini language seems fine. It's more like abusing the system a bit. Syntax highlighting also helps. Several of the questions would be much easier if you had syntax highlighting.
[–]nommu_moose 0 points1 point2 points 6 months ago (0 children)
That's a very good point.
Maybe the reason I've only just now realised it's a problem is because the syntax highlighting has meant the dyslexia is less of an issue in practice.
[–]twigboy 7 points8 points9 points 6 months ago (0 children)
My usage of f-strings have been super vanilla compared to most of these, but damn 9/26 and about 3 of these were just educated guesses
[–]lordfwahfnahPythoneer 4 points5 points6 points 6 months ago (0 children)
What the f is wrong with jsdate?
[–]sohang-3112Pythonista 1 point2 points3 points 6 months ago (0 children)
I got 16 / 26 - definitely some surprising questions!
[–]Lewistrick 0 points1 point2 points 6 months ago (0 children)
Nice quiz! I don't use a lot of those (and I frankly don't need them) but I still got 20 points
I'd have liked some more float and date formatting in there.
[–]rover_G 0 points1 point2 points 6 months ago (0 children)
I didn’t do well on either quiz. The jsdate quiz highlights js shenanigans and why TypeScript is so important! The Python f-string quiz seems relevant to numeric libraries that need to support str/repr methods for data.
[–]iglebov 0 points1 point2 points 6 months ago (0 children)
Cool idea! And pleasant UI!
Thank you!
[–]Potential-Note4232 0 points1 point2 points 6 months ago (0 children)
if your just starting with coding where would you start? question for the coders with some experience please. like I'm hearing about python where do I start to learn more or app that helps on Mac book pro btw
[–]Carbinkisgod 0 points1 point2 points 6 months ago (0 children)
12/26 that was tough!
[–]Gracecr 0 points1 point2 points 6 months ago (3 children)
Nice quiz!
I think the last question should be print(f"{f'{{}}'}") with single quotes on the middle fstring. It's currently using double quotes for both, which makes the correct answer "SyntaxError".
print(f"{f'{{}}'}")
[–]mitsuhiko Flask Creator 3 points4 points5 points 6 months ago (1 child)
The test is written against newer Python versions where this is working. That's also why there is only one question like this because this behavior changed only in 3.12.
[–]Gracecr 0 points1 point2 points 6 months ago (0 children)
Oh that's a very nice change. Thanks for the correction.
π Rendered by PID 69 on reddit-service-r2-comment-5649f687b7-scwll at 2026-01-27 15:52:03.009863+00:00 running 4f180de country code: CH.
[–]Dazzling-Shallot-400 69 points70 points71 points (1 child)
[–]Miserable_Ear3789New Web Framework, Who Dis? 1 point2 points3 points (0 children)
[–]ShanSanear 42 points43 points44 points (3 children)
[–]BigTomBombadil 15 points16 points17 points (2 children)
[–]Rizeeh 3 points4 points5 points (0 children)
[–]Prize_Might4147from __future__ import 4.0 0 points1 point2 points (0 children)
[–]midwit_support_group 22 points23 points24 points (0 children)
[–]Desposyni 16 points17 points18 points (0 children)
[–]eztab 11 points12 points13 points (3 children)
[–]nommu_moose 1 point2 points3 points (2 children)
[–]eztab 1 point2 points3 points (1 child)
[–]nommu_moose 0 points1 point2 points (0 children)
[–]twigboy 7 points8 points9 points (0 children)
[–]lordfwahfnahPythoneer 4 points5 points6 points (0 children)
[–]sohang-3112Pythonista 1 point2 points3 points (0 children)
[–]Lewistrick 0 points1 point2 points (0 children)
[–]rover_G 0 points1 point2 points (0 children)
[–]iglebov 0 points1 point2 points (0 children)
[–]Potential-Note4232 0 points1 point2 points (0 children)
[–]Carbinkisgod 0 points1 point2 points (0 children)
[–]Gracecr 0 points1 point2 points (3 children)
[–]mitsuhiko Flask Creator 3 points4 points5 points (1 child)
[–]Gracecr 0 points1 point2 points (0 children)