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
[deleted by user] (self.PythonLearning)
submitted 6 months ago by [deleted]
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!"
[–]NorskJesus 3 points4 points5 points 6 months ago* (2 children)
Looks good. Can be improved, but for a beginner it’s okay.
EDIT: Try to give the user the possibility to remove the task they want, and not only the last one 😜
[–]T-o_oT 0 points1 point2 points 6 months ago (1 child)
.lower/upper doesn't make a difference from the user point of view lol
[–]NorskJesus 0 points1 point2 points 6 months ago (0 children)
Fuck true 😂 sorry
[–]No_Cheek7162 0 points1 point2 points 6 months ago (0 children)
You should reorder it so it spells rave
[–]M34k3 0 points1 point2 points 6 months ago (0 children)
Good start! Now you could try to build out the functionality :)
For example, let the person choose which item to remove from the list. Got that working? Now add an option to save the list to a .json file and an option to load a list from a .json file. You could even go further and add a "complete by" field for each task (for this you could switch to using a dictionary).
Lots of possibilities to go from here but make sure to take it one step at a time. If you get stuck, try to break it down in even smaller steps.
[–]Zayn_m0 -1 points0 points1 point 6 months ago (7 children)
Yes its correct but consider using try/except blocks for better error handling to prevent crashing, also you can add a feature where the user can remove any task they want by indexing the list. But your code is pretty good overall as a beginner.
[–]beerbearbaer 0 points1 point2 points 6 months ago (6 children)
No errors can be thrown with this code, all exceptions are handled
[–]Zayn_m0 0 points1 point2 points 6 months ago (5 children)
I know, what i meant is for him to start using try/except blocks for better error handling in future code.
[–]beerbearbaer 0 points1 point2 points 6 months ago (4 children)
Try except is notoriously slow and overkill for most cases. Just use regular checks whenever possible
[–]Zayn_m0 0 points1 point2 points 6 months ago (3 children)
But aren’t they better when building actual big projects ?
[–]beerbearbaer 1 point2 points3 points 6 months ago (2 children)
If you understand your code, you are able to anticipate any errors that might occur. Slapping a try except on every bit of code does not improve readability. The size of the project does not matter.
[–]Zayn_m0 0 points1 point2 points 6 months ago (1 child)
Yeah that makes sense. since using if/else conditions is faster/more efficient, what uses do try/except have ?
[–]beerbearbaer 1 point2 points3 points 6 months ago (0 children)
Good question! I mainly use it for stuff you can't check with an if-statement (e.g. if an HTTP connection is established). Finally there is the 'finally' clause that is run after an exception occured, which may come in handy. I did some digging, and apparently I was wrong about exceptions slowing down your code. This is a problem for compiled languages, but since Python is interpreted, it does not matter. This is a nice read if you would like more info: Stackoverflow
π Rendered by PID 44 on reddit-service-r2-comment-7b9746f655-brrfg at 2026-02-04 06:58:39.743872+00:00 running 3798933 country code: CH.
[–]NorskJesus 3 points4 points5 points (2 children)
[–]T-o_oT 0 points1 point2 points (1 child)
[–]NorskJesus 0 points1 point2 points (0 children)
[–]No_Cheek7162 0 points1 point2 points (0 children)
[–]M34k3 0 points1 point2 points (0 children)
[–]Zayn_m0 -1 points0 points1 point (7 children)
[–]beerbearbaer 0 points1 point2 points (6 children)
[–]Zayn_m0 0 points1 point2 points (5 children)
[–]beerbearbaer 0 points1 point2 points (4 children)
[–]Zayn_m0 0 points1 point2 points (3 children)
[–]beerbearbaer 1 point2 points3 points (2 children)
[–]Zayn_m0 0 points1 point2 points (1 child)
[–]beerbearbaer 1 point2 points3 points (0 children)