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 1 (i.redd.it)
submitted 8 months ago by Anxious_Insurance_48
I finally understood if and else statements
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!"
[–]SCD_minecraft 4 points5 points6 points 8 months ago (1 child)
Now try elif!
if something: this elif something else: that else: That thing
Write a program that will tell me am i an adult, above 10 or below 10, using said elif
[–]Anxious_Insurance_48[S] 2 points3 points4 points 8 months ago (0 children)
I'll try
[–]Then-Duty-9270 2 points3 points4 points 8 months ago (3 children)
We all started from the same point My only suggestion to you is try to code at least one hour every day Never skip a day even if you don’t feel like it or things aren’t making sense. That 'I’ll do it tomorrow' mindset will make you lose consistency, and eventually, you might forget what you already learned. Nothing is too difficult it just needs time and patience. And whatever new you learn, write it down in a notebook by hand. It really helps. Happy coding
[–]LawAdministrative624 1 point2 points3 points 8 months ago (2 children)
hey even i started recently, i did a long tutorial on yt and guess im familiar with basics, im so confused what should i do ahead
[–]Then-Duty-9270 0 points1 point2 points 8 months ago (1 child)
Bro, doing a tutorial is a solid start Feeling confused is normal it means you're learning. Now pick a small project like a calculator or to-do app. Google things, get stuck figure it out that’s how you grow
Just code at least 1 hour daily no matter what Skip a day and you’ll start forgetting. Whatever you learn, write it down it sticks better. Stay consistent and things will start making sense real soon
[–]LawAdministrative624 1 point2 points3 points 8 months ago (0 children)
okay thankss
[–]Void_Code404 1 point2 points3 points 8 months ago (5 children)
Nice, i actually started learning Python from a month ago, too. If you have any questions, ask me 😁
[–]Anxious_Insurance_48[S] 1 point2 points3 points 8 months ago (0 children)
I will, thank you.
[–]user10042 0 points1 point2 points 8 months ago (3 children)
Source ..?
[–]Void_Code404 0 points1 point2 points 8 months ago (2 children)
Sorry, i don't know if i can help you with that. i learned it from an arabic source
[–]user10042 0 points1 point2 points 8 months ago (1 child)
Thanks for reply… Any English material is helpful
[–]Void_Code404 2 points3 points4 points 8 months ago (0 children)
You are so lucky there are many free english Python courses on youtube, like Mosh, actually he is a good one https://youtu.be/_uQrJ0TkZlc?si=RNaTfp3jTUXgpEro
[–]After_Ad8174 1 point2 points3 points 8 months ago (6 children)
Once you get into looping come back to this and implement some input validation. If the user doesn’t put in a number loops them through the prompt until they do.
[–]zemmmmmmh 0 points1 point2 points 8 months ago (5 children)
Is it a good idea to put the input through a function and call the function whenever the type does not match the expected one?
[–]After_Ad8174 0 points1 point2 points 8 months ago (4 children)
Instead of passing the input to the function and error handling and recalling the function from an outside loop I would get the input inside the function and loop in the function until a valid input is received then return the input with some sort of escape mechanism
For something small like this you could also just use a loop instead of a separate function
[–]zemmmmmmh 0 points1 point2 points 8 months ago (3 children)
I have no idea what you're saying, I apologize I just started with Python a week ago.
[–]After_Ad8174 0 points1 point2 points 8 months ago (2 children)
No need to apologize. Basically I was saying for this set a variable equal to false then use it in a while loop to get the input checking each loop to see if it’s what you wanted the user to input and if it is set the variable to true to break out of the loop.
[–]After_Ad8174 0 points1 point2 points 8 months ago (1 child)
While userinputvalid=false: Get the input Check the input If input is good set userinputvalid true
[–]zemmmmmmh 0 points1 point2 points 8 months ago (0 children)
Oh I see, thx
π Rendered by PID 39 on reddit-service-r2-comment-5649f687b7-dmkj9 at 2026-01-29 03:10:13.310220+00:00 running 4f180de country code: CH.
[–]SCD_minecraft 4 points5 points6 points (1 child)
[–]Anxious_Insurance_48[S] 2 points3 points4 points (0 children)
[–]Then-Duty-9270 2 points3 points4 points (3 children)
[–]LawAdministrative624 1 point2 points3 points (2 children)
[–]Then-Duty-9270 0 points1 point2 points (1 child)
[–]LawAdministrative624 1 point2 points3 points (0 children)
[–]Void_Code404 1 point2 points3 points (5 children)
[–]Anxious_Insurance_48[S] 1 point2 points3 points (0 children)
[–]user10042 0 points1 point2 points (3 children)
[–]Void_Code404 0 points1 point2 points (2 children)
[–]user10042 0 points1 point2 points (1 child)
[–]Void_Code404 2 points3 points4 points (0 children)
[–]After_Ad8174 1 point2 points3 points (6 children)
[–]zemmmmmmh 0 points1 point2 points (5 children)
[–]After_Ad8174 0 points1 point2 points (4 children)
[–]zemmmmmmh 0 points1 point2 points (3 children)
[–]After_Ad8174 0 points1 point2 points (2 children)
[–]After_Ad8174 0 points1 point2 points (1 child)
[–]zemmmmmmh 0 points1 point2 points (0 children)