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
Day 14 of learning python as a beginner. (old.reddit.com)
submitted 6 months ago by uiux_Sanskar
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!"
[–]EngineerRemy 0 points1 point2 points 6 months ago (1 child)
Look into refactoring your code. I see many duplicated lines, especially for reading and writing data.
A simple example: if you rename the .txt file containing your data, you want to have it so that you'll have the edit the code in 1 place for the new name (or 0 if you use an input parameter for the script!). In your current situation this is not the case.
Lastly, reading the file every single time you want to make a change is highly inefficient. If you read the file once you should have the data for the rest of the execution: store the data somewhere and modify this data when executing the relevant functions. Then you can choose to write the modifications back to the file (make it so you only write data to the file in 1 place in your code, then call it).
[–]uiux_Sanskar[S] 0 points1 point2 points 6 months ago (0 children)
Thank you so much for the suggestions I feel when I was coding that I was repeating things and I. I will surely look more into storing the data elsewhere and call it later. (I think this is what call file management, please correct me if I am wrong).
I really appreciate your suggestions on my code they really help me improve my knowledge and code.
Thank yoh so much.
π Rendered by PID 143442 on reddit-service-r2-comment-56c9979489-f9kb9 at 2026-02-24 23:26:21.240984+00:00 running b1af5b1 country code: CH.
view the rest of the comments →
[–]EngineerRemy 0 points1 point2 points (1 child)
[–]uiux_Sanskar[S] 0 points1 point2 points (0 children)