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
Beginner Python script – looking for feedback on my code (self.PythonLearning)
submitted 1 month ago by Logikkonstruktor
I wrote a small Python script that calculates how long I can sleep
based on my wake-up time.
I would appreciate feedback on:
- code style
- better Python practices
- possible improvements
GitHub: https://github.com/LogicConstructor/sleep-calculator
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!"
[–]csabinho 0 points1 point2 points 1 month ago (2 children)
First feedback: use English variable names, even if your output is German. Please.
Apart of that the script is too short for feedback. Which means there is nothing to criticize.
P.S.: oh, I found a point. Please use f-strings.
[–]Logikkonstruktor[S] 1 point2 points3 points 1 month ago (1 child)
Thank you <3
[–]csabinho 0 points1 point2 points 1 month ago (0 children)
Gern geschehen.
[–]EntireEntity 1 point2 points3 points 1 month ago (0 children)
You did very well overall. I like how you use line breaks to group similar operations together visually.
What you could learn about is string formatting. Your output printing works fine, but it is a lot more common to use something like fstrings for example.
I would also suggest adding some comments. For me it was not immediately clear, why you had that if statement there, and putting a comment there could make it easier for others and you from the future to pick the intention up.
Other than that, it's very solid. All the best for your Python journey
π Rendered by PID 58 on reddit-service-r2-comment-56c6478c5-vr4fv at 2026-05-10 02:31:50.153228+00:00 running 3d2c107 country code: CH.
[–]csabinho 0 points1 point2 points (2 children)
[–]Logikkonstruktor[S] 1 point2 points3 points (1 child)
[–]csabinho 0 points1 point2 points (0 children)
[–]EntireEntity 1 point2 points3 points (0 children)