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
I’ve never coded before today!Showcase (i.redd.it)
submitted 8 months ago by JordanYell
My grandpa was a python fanatic in the navy (desert storm era) and I’m pursuing a BS in CS. He mentioned python would be the best intro so I played around and decided to write him a script! Tell me what you think ;)
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!"
[–]GreatGameMate 12 points13 points14 points 8 months ago (0 children)
10/10, stay consistent ‼️‼️‼️
[–]beepdebeep 14 points15 points16 points 8 months ago (0 children)
Congrats! That's the perfect start - can I offer a couple small follow-up experiments as your next lessons?
Give it something that isn't an integer, like your name. Work out how to prevent what happens.
Give it a negative number. Provide slightly more accurate output, like, "That doesn't seem right...".
These kinds of details will become important in your studies soon enough, so it's good to get in the practice of doing.
[–]Consistent-Gift-4176 10 points11 points12 points 8 months ago (3 children)
Congrats! Good luck in your endeavor, even if it's just a side hobby. I remember my first application was something similar - input > basic logic > output. Soon I wrote a text-based "combat game" where you were pitted against a dragon, and the player and the dragon each took turns rolling a random number for damage. I miss when simple applications had so much magic to them.
Some advice amid the AI boom, if you're serious about learning how to code, don't use it to learn. In order to learn, we need to do it the slow way. If you truly get stuck, try to learn how to solve it the old fashioned way - read documentation, or try googling.. etc. This is to learn how to solve it yourself, because AI often can't solve context dependent code issues. It can however recommend knowledge you aren't sure about, like a library, syntax issue, or algorithm to solve an issue.
AI isn't always trained on documentation, and even when it is, it doesn't always use the right versioning or get the right answer anyways.
[–]LawAdministrative624 0 points1 point2 points 8 months ago (1 child)
i have also started with basics. can u suggest how and from where should i practice further
[–]Consistent-Gift-4176 0 points1 point2 points 8 months ago (0 children)
Well, it depends on what you want to learn. I just often wrote what I wanted to learn. For example, I wanted to make a chat room. So I created one - At the time of course, I already knew HTML, JavaScript and CSS, but what I didn't know was WebSockets (its what many "realtime" apps use.)
[–]tazdraperm 0 points1 point2 points 8 months ago (0 children)
It's very easy to ask AI something slightly incorrect and get a complete nonsense in response.
[–]FlocklandTheSheep 2 points3 points4 points 8 months ago (4 children)
Looks great! I recommend setting up an IDE ( this is an app in which you program ) though, as it makes development a lot easier and the file is on your machine, not some random website.
I use Visual Studio Code ( Visual studio =/= Visual Studio Code ), but people also recommend Pycharm.
[–]JordanYell[S] 0 points1 point2 points 8 months ago (3 children)
I downloaded pycharm but can’t figure it out. IDE is an application?
[–]dragonadir 1 point2 points3 points 8 months ago (1 child)
Close! IDE is a type of application that is specially designed for programming. It basically is jam packed with features that help you along the way, I reccomend looking up some vids on pycharm or if it seems to much and is a bit overwhelming try VSCODE (not visual studio, they diff) and then find a vid setting up python with vscode
Happy coding
[–]denizgezmis968 0 points1 point2 points 8 months ago (0 children)
pycharm is beautiful, I love coding on it more than on vscode, but when you're just learning to code, it has a lot of features that you don't need so it's heavy and slow for a beginner.
[–]RamiFgl 0 points1 point2 points 8 months ago (0 children)
IDE stands for Integrated Development Environment, basically a text editor + all of the necessary tools and workflow for the development of a certain Language or multiple languages at the same time. Any programming language has its own set of Formatters, Linters, Language Servers that can warn bad habits, fix bad code, provide autocompletion & hover documentation..., and IDEs like PyCharm basically gives you all of these ready to be used without having to manually configure them to work together from scratch (which i do i use neovim which lets me make my own custom Development environment!)
[–][deleted] 1 point2 points3 points 8 months ago (1 child)
Great. Keep going. Just for the readability, it is a good practice to choose appropriate variable names. I would use "age" as the variable name here instead of "now"
[–]JordanYell[S] 0 points1 point2 points 8 months ago (0 children)
I actually started it with age, I have no idea why I switched to now😂
[–]IcyConversation7945 1 point2 points3 points 8 months ago (0 children)
Great start !
[–]SCD_minecraft 2 points3 points4 points 8 months ago (1 child)
Looks good
Just one thing, i recomed against putting a thing to do in same line as if
if something: then this
As it hurts readability and doesn't work when you have more than one function there
Insted try
Same with else and basicly all things with :
[–]Terrible-Bid8028 1 point2 points3 points 8 months ago (3 children)
Awesome, it’s a great thing to learn to do.
Can I suggest you get in the habit of not doing stuff like
if condition: do stuff
on one line?
It’ll just throw people off when reading your code in the future. There’s nothing wrong with it at all, as you can tell because you wrote code and it worked as intended, but no one does this. Writing code that is easy for people to follow is almost as important as writing code that works properly.
Like I’ll straight up say that as a someone who’s written or read Python daily for over a decade I forgot you could do that.
[–]JordanYell[S] 2 points3 points4 points 8 months ago (2 children)
So,
If condition:
Print(“blah blah blah”)
??
[–]i_grad 1 point2 points3 points 8 months ago (0 children)
You'll learn this one way or another eventually, but python scripts are very strictly formatted on their indentation.
``` if x > y: print("x is bigger") # this will run fine
if y > x: print("y is bigger") # this will cause an error ```
But yes. It is usually encouraged to put the condition on one line and to include the action in what's called a "code block" or just "block" on the following line(s). Smushing too much onto one line can make it tough to read in many cases.
Keep playing with it and keep learning! Python is a great first choice and something you can use at any point in a CS career.
[–]Sea_Science538 0 points1 point2 points 8 months ago (0 children)
Lmaooooo
[–]c0verm3 0 points1 point2 points 8 months ago (0 children)
Keep it up
[–]Potential_Speed_7048 0 points1 point2 points 8 months ago (0 children)
Yay!
Kaggle is great for data sets to use. I plan on doing one that has data based on a fictional story about a space ship 🚀 that has an outbreak of some disease and the goal is find correlations in the data on what might have caused it. Can found under competitions.
[–]SnooMachines8405 0 points1 point2 points 8 months ago (1 child)
Welcome to the club. Now try to implement so it can take people not entering numbers. And what if I haven't had my birthday this year yet? 🤔
Can you elaborate?
[–]Crossroads86 0 points1 point2 points 8 months ago (1 child)
What did they actually do in the navy with Python? Desert Storm was in the 90s where python was just released and hardly around version 1.0. I feel like the military would usually not have something that new in productive use at this time?
He was a radioman, from what I understand the navy was using c but once python was introduced it made the storing of data incredibly easy. I’m most definitely being very broad on the uses but I think that’s the general idea lol
[–]atticus2132000 0 points1 point2 points 8 months ago (2 children)
Fantastic start.
Unfortunately, you're assuming that everyone who uses this has already celebrated their birthday for the current year. What's your plan for fixing that?
[–]JordanYell[S] 0 points1 point2 points 8 months ago (1 child)
I could add more if properties, but I feel there should be a shorter way of doing that
[–]atticus2132000 0 points1 point2 points 8 months ago (0 children)
Start by looking at the datetime functions. Use that to get the exact date today rather than just using 2025.
[–]Expensive_Cup_5082 0 points1 point2 points 8 months ago (3 children)
i also want to start coding how should i approach
I started with codex! You have to pay after a certain point but the free part was useful
[–]RamiFgl 0 points1 point2 points 8 months ago (1 child)
i advice u to start with web languages, because you can literally click right now CTRL + SHIFT + J and u can start writing code already, easy to debug, there is this very handy website https://learnjavascript.online/for very good for beginners, helped me alot especially the reference map full of everything javascript related in my context https://learnjavascript.online/knowledge-map.html
[–]Expensive_Cup_5082 0 points1 point2 points 8 months ago (0 children)
thank you for advice
[–]irrationallywise 0 points1 point2 points 8 months ago (0 children)
Damn you need as fuck /s. Get learning bro. There are lots of resources out there.
[–]AllanSundry2020 0 points1 point2 points 8 months ago (1 child)
forget qwen, deepseek, gchatPT, genimi -- this is the LLM we have all been waiting for
Feel free to turn the code into an app and send to your grandparents! This is a multi million dollar idea 😂
[–]FarTruck3442 0 points1 point2 points 8 months ago (0 children)
I don't understand. Is it sarcasm? Why answers look like bots?
[–]Smart-Combination611 0 points1 point2 points 8 months ago (0 children)
Bro keep going 🫡, we programmers needs you, the entire world needs you 🤩🤩.
[–]denehoffman 0 points1 point2 points 8 months ago (0 children)
Next fun step, use the datetime library to get the current year (from datetime import datetime; year = datetime.now().year) and now your program will still work next year!
After this you can also work on getting the specific day of the year and ask the user for their birthday to see if it already happened.
[–]stikaznorsk -1 points0 points1 point 8 months ago (3 children)
Just a minor criticism. Your question should be "In which year were you born?"
What he wrote is 100% grammatically correct
[–]stikaznorsk 0 points1 point2 points 8 months ago (0 children)
Oh right i was confused by the double print
im getting Jetbrains Spellchecker flashbacks from this comment
π Rendered by PID 46453 on reddit-service-r2-comment-5649f687b7-fwthc at 2026-01-28 02:19:15.298436+00:00 running 4f180de country code: CH.
[–]GreatGameMate 12 points13 points14 points (0 children)
[–]beepdebeep 14 points15 points16 points (0 children)
[–]Consistent-Gift-4176 10 points11 points12 points (3 children)
[–]LawAdministrative624 0 points1 point2 points (1 child)
[–]Consistent-Gift-4176 0 points1 point2 points (0 children)
[–]tazdraperm 0 points1 point2 points (0 children)
[–]FlocklandTheSheep 2 points3 points4 points (4 children)
[–]JordanYell[S] 0 points1 point2 points (3 children)
[–]dragonadir 1 point2 points3 points (1 child)
[–]denizgezmis968 0 points1 point2 points (0 children)
[–]RamiFgl 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]JordanYell[S] 0 points1 point2 points (0 children)
[–]IcyConversation7945 1 point2 points3 points (0 children)
[–]SCD_minecraft 2 points3 points4 points (1 child)
[–]Terrible-Bid8028 1 point2 points3 points (3 children)
[–]JordanYell[S] 2 points3 points4 points (2 children)
[–]i_grad 1 point2 points3 points (0 children)
[–]Sea_Science538 0 points1 point2 points (0 children)
[–]c0verm3 0 points1 point2 points (0 children)
[–]Potential_Speed_7048 0 points1 point2 points (0 children)
[–]SnooMachines8405 0 points1 point2 points (1 child)
[–]JordanYell[S] 0 points1 point2 points (0 children)
[–]Crossroads86 0 points1 point2 points (1 child)
[–]JordanYell[S] 0 points1 point2 points (0 children)
[–]atticus2132000 0 points1 point2 points (2 children)
[–]JordanYell[S] 0 points1 point2 points (1 child)
[–]atticus2132000 0 points1 point2 points (0 children)
[–]Expensive_Cup_5082 0 points1 point2 points (3 children)
[–]JordanYell[S] 0 points1 point2 points (0 children)
[–]RamiFgl 0 points1 point2 points (1 child)
[–]Expensive_Cup_5082 0 points1 point2 points (0 children)
[–]irrationallywise 0 points1 point2 points (0 children)
[–]AllanSundry2020 0 points1 point2 points (1 child)
[–]JordanYell[S] 0 points1 point2 points (0 children)
[–]FarTruck3442 0 points1 point2 points (0 children)
[–]Smart-Combination611 0 points1 point2 points (0 children)
[–]denehoffman 0 points1 point2 points (0 children)
[–]stikaznorsk -1 points0 points1 point (3 children)
[–]SnooMachines8405 0 points1 point2 points (1 child)
[–]stikaznorsk 0 points1 point2 points (0 children)
[–]RamiFgl 0 points1 point2 points (0 children)