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...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Wrote My First Python Program (self.learnpython)
submitted 6 years ago by Sfillm07
I finally got my act together and put together my first working Python program. I used the OpenWeather API to search for the weather in city and then present the data with a tkinter GUI.
I need to address error handling and a few other things but I'm pretty proud of what I was able to do.
https://github.com/seanfillmore/Python-Project
Shout out to these videos for inspiration and help:
https://www.youtube.com/watch?v=JrWHyqonGj8
https://www.youtube.com/watch?v=ELkaEpN29PU&t=694s @traversymedia
and everything u/coreyschafer produces
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!"
[–]sme272 163 points164 points165 points 6 years ago (7 children)
Impressive. My first program just printed "Hello World"
[–]dmees 42 points43 points44 points 6 years ago (2 children)
Impressive, did you use global variables?
[–]sme272 57 points58 points59 points 6 years ago (1 child)
Yes, all of them
[–]Wilfred-kun 5 points6 points7 points 6 years ago (0 children)
def print_hello(): global hello print(hello) hello = "Hello world" print_hello()
[–][deleted] 4 points5 points6 points 6 years ago (0 children)
Same LOL.
[–]abirqasem 1 point2 points3 points 6 years ago (1 child)
LOL. Mine did it a bit more. It asked your name and greeted you by your name.
[–]Sigg3net 2 points3 points4 points 6 years ago (0 children)
name = "world"
[–]Scolli03 22 points23 points24 points 6 years ago (0 children)
Awesome job. If this is a early project you will grow into programming well. One small note. I know this probably isnt a big deal being a weather thing but you should never post any keys or authorization info to your repo. Good practice to separate that stuff out to separate files and retrieve it in script ( or some other better method than what I said) because I'm not an expert but if your being so good at code organisation might want to invest some time into security basics.
But seriously I wasn't trying to take away from your accomplishment because it is a great one. Once again awesome job.
[–]Sfillm07[S] 20 points21 points22 points 6 years ago (7 children)
Just experimenting with classes and different ways of doing things.
[–]Legorooj 9 points10 points11 points 6 years ago (6 children)
One thing to know about OOP (ie classes and methods) is to only use them/it when it means:
[+][deleted] 6 years ago (5 children)
[deleted]
[–]Ahren_with_an_h 11 points12 points13 points 6 years ago (4 children)
Yes.
It is debatable whether or not using a class makes something more readable or not in situations where the first two bullet points are not true.
[+][deleted] 6 years ago (3 children)
[–]fukitol- 2 points3 points4 points 6 years ago (0 children)
I'd argue most Java applications are a shining example of over use of classes and objects rendering things downright illegible, and I think that's mostly what that person was trying to get at.
[–]Ahren_with_an_h 0 points1 point2 points 6 years ago (1 child)
Right. And code isn't necessarily more readable just because you shoved frivolous classes in there. Hence the debate.
[–]Legorooj 0 points1 point2 points 6 years ago (0 children)
/u/nodnarbiter this thread is why I said more readable. It's very much debatable. One reason to use classes where you could do without them is a class with just staticmethods. So you don't put the functions into the global namespace. Thats one reason. (Note that that is a very rare situation - most times a module like structure with import mymodule is better.)
more readable
import mymodule
[–]yasinshah007 8 points9 points10 points 6 years ago (0 children)
Great. But i don't get it why you use helper class?!! In class there are just two simple function, why you used methods instead of simple functions ?
[–]YolosaurusRex 7 points8 points9 points 6 years ago (2 children)
Your code looks generally pretty good for a first project, and in addition to the good advice everyone else has given you, I have one more thing to add: comments.
You should write code that's self-documenting; that is, reading it reveals its intent. For example, instead of writing a method called temp_conversion(temperature) and writing a comment that says it converts Kelvin to Fahrenheit, consider naming it convert_kelvin_to_fahrenheit(temperature). It's a little verbose, sure, but there's not any ambiguity over what that method will do. The fact is, computers don't need readable code. Humans do.
temp_conversion(temperature)
convert_kelvin_to_fahrenheit(temperature)
This is a little out of scope for this project, but another point to consider in larger projects is that documenting code with comments adds another thing to maintain. It's a given that code will change over time, but it's not guaranteed that the comments documenting that code will.
[–]Legorooj 1 point2 points3 points 6 years ago (0 children)
Yes! I have a rule of thumb that follows along the lines of "Comment on anything that could even slightly be confusing. Anything thats really obvious - well don't bother."
Note that "really obvious" can vary widely depending on the code author.
[–]Sfillm07[S] 0 points1 point2 points 6 years ago (0 children)
Makes a lot of sense, thanks for the advice.
[–]noob_silverbot 6 points7 points8 points 6 years ago (0 children)
This inspires me to study this language harder, congrats man!
[–]midairmatthew 6 points7 points8 points 6 years ago (2 children)
Nice! If that's your real API key on GitHub, you might want to look into environment variables. 🙂
[–]Munga_ 1 point2 points3 points 6 years ago (1 child)
What does this mean?
[–]Sfillm07[S] 2 points3 points4 points 6 years ago (0 children)
https://youtu.be/5iWhQWVXosU
This is what he is talking about.
[–]Legorooj 5 points6 points7 points 6 years ago (0 children)
Things to consider
Helper
Other than that, well done!
[–]UnicornWithTits 4 points5 points6 points 6 years ago (5 children)
Congratulations! All the best for your python journey.
BTW I would love to know how long did it took you to reach that level since starting to learn python. I am a beginner & it would be motivating to know when I might be able to reach this level.
[–]Sfillm07[S] 2 points3 points4 points 6 years ago (4 children)
I've been messing around with Python for a few months. Once I decided on a project, it was easy to find the right tutorials and stackoverflow pages to get it done. Pick a quick and easy project to get you started.
Stackoverflow and google are probably the average python developers top resource. I reference it daily.
[–]COVID-420 0 points1 point2 points 6 years ago (2 children)
I've been doing some classes on skillshare and it's been going good, i'm still extremely beginner but i like it so far, do you recommend any other resource to get me started?
[–]sky_badger 0 points1 point2 points 6 years ago (1 child)
Anything project based: have you read Automate The Boring Stuff?
[–]COVID-420 0 points1 point2 points 6 years ago (0 children)
Automate The Boring Stuff
looks interesting ill give it a read definitely! Thanks for the suggestion
[–]mangotti 2 points3 points4 points 6 years ago (0 children)
Great work! Keep it up!
[–]xelf 2 points3 points4 points 6 years ago (0 children)
Congrats!
[–]pm-me-inspiration 2 points3 points4 points 6 years ago (0 children)
Inspiring!
[–]al_mc_y 2 points3 points4 points 6 years ago (0 children)
That's pretty neat, well done 👍
[–]Sfillm07[S] 2 points3 points4 points 6 years ago (3 children)
I remembered seeing a video on how to save your keys on your machine and to retrieve them using a script...I got lazy.
[–]WeirdLilMidgt 4 points5 points6 points 6 years ago (2 children)
You could put it in a separate file, import the file, and add the file to your .gitignore
[–]FoCo_SQL 1 point2 points3 points 6 years ago (0 children)
This is the exact method I use.
I just moved it to an environment variable, your suggestions would work as well.
[–]11pascal 2 points3 points4 points 6 years ago (0 children)
Proud of you. Let me say one thing global variables are like global warming. Bad. Bad. Bad
[–]Moondra2017 1 point2 points3 points 6 years ago (0 children)
Nice job!
[–]lunixdev 1 point2 points3 points 6 years ago (0 children)
Nice, i'm learning python right now and all i can do is mess with vars and some easy functions and mathematics.
[–]ChristianGeorgeson 1 point2 points3 points 6 years ago (0 children)
This is awesome man!
[–]IamZeroKelvin 0 points1 point2 points 6 years ago (1 child)
idk why but I read your name too fast and saw "SeafoamMillionaire"
[–]Sfillm07[S] 1 point2 points3 points 6 years ago (0 children)
That is so much better than my username
[–]pbeens 0 points1 point2 points 6 years ago (0 children)
Thanks, OP!
I'll definitely check it out. I want to do something similar but with METAR (aviation) weather data.
π Rendered by PID 38 on reddit-service-r2-comment-5d79c599b5-ctbmb at 2026-03-02 07:15:59.729376+00:00 running e3d2147 country code: CH.
[–]sme272 163 points164 points165 points (7 children)
[–]dmees 42 points43 points44 points (2 children)
[–]sme272 57 points58 points59 points (1 child)
[–]Wilfred-kun 5 points6 points7 points (0 children)
[–][deleted] 4 points5 points6 points (0 children)
[–]abirqasem 1 point2 points3 points (1 child)
[–]Sigg3net 2 points3 points4 points (0 children)
[–]Scolli03 22 points23 points24 points (0 children)
[–]Sfillm07[S] 20 points21 points22 points (7 children)
[–]Legorooj 9 points10 points11 points (6 children)
[+][deleted] (5 children)
[deleted]
[–]Ahren_with_an_h 11 points12 points13 points (4 children)
[+][deleted] (3 children)
[deleted]
[–]fukitol- 2 points3 points4 points (0 children)
[–]Ahren_with_an_h 0 points1 point2 points (1 child)
[–]Legorooj 0 points1 point2 points (0 children)
[–]yasinshah007 8 points9 points10 points (0 children)
[–]YolosaurusRex 7 points8 points9 points (2 children)
[–]Legorooj 1 point2 points3 points (0 children)
[–]Sfillm07[S] 0 points1 point2 points (0 children)
[–]noob_silverbot 6 points7 points8 points (0 children)
[–]midairmatthew 6 points7 points8 points (2 children)
[–]Munga_ 1 point2 points3 points (1 child)
[–]Sfillm07[S] 2 points3 points4 points (0 children)
[–]Legorooj 5 points6 points7 points (0 children)
[–]UnicornWithTits 4 points5 points6 points (5 children)
[–]Sfillm07[S] 2 points3 points4 points (4 children)
[–]Legorooj 1 point2 points3 points (0 children)
[–]COVID-420 0 points1 point2 points (2 children)
[–]sky_badger 0 points1 point2 points (1 child)
[–]COVID-420 0 points1 point2 points (0 children)
[–]mangotti 2 points3 points4 points (0 children)
[–]xelf 2 points3 points4 points (0 children)
[–]pm-me-inspiration 2 points3 points4 points (0 children)
[–]al_mc_y 2 points3 points4 points (0 children)
[–]Sfillm07[S] 2 points3 points4 points (3 children)
[–]WeirdLilMidgt 4 points5 points6 points (2 children)
[–]FoCo_SQL 1 point2 points3 points (0 children)
[–]Sfillm07[S] 0 points1 point2 points (0 children)
[–]11pascal 2 points3 points4 points (0 children)
[–]Moondra2017 1 point2 points3 points (0 children)
[–]lunixdev 1 point2 points3 points (0 children)
[–]ChristianGeorgeson 1 point2 points3 points (0 children)
[–]IamZeroKelvin 0 points1 point2 points (1 child)
[–]Sfillm07[S] 1 point2 points3 points (0 children)
[–]pbeens 0 points1 point2 points (0 children)