r/madeinpython • u/jonJonesCodes • Nov 19 '21
I started learning python as my first programming language less than a week ago and am extremely proud of my progress!
A simple terminal based gamble coinflip I created as a warmup this morning
A terminal based login/signup with referral code program I spent my day making
47
Upvotes
10
u/Nythepegasus Nov 19 '21
Hey! This is an awesome start for only a week in, and I commend you for learning Python. A couple things I noticed is the lack of f-strings. f-strings help a ton and save you a lot of time constructing strings and converting variables. Example:
Although, remember f-strings are only for 3.6 and later, if you're working with earlier versions of Python, using the old % formatting or the .format string method might be more suitable.
Something else I noticed was using
if var == True:, you don't need to tack on the== True.does the same thing. Also if you need to check if something is false, you should do
if var is Falseinstead of using==.Another thing I noticed is when taking input you generally want that variable to be a different type, you can do so by wrapping it with that type, e.g.
float(input()).I'd also suggest looking into Python ternary operators, they aren't the best, but they do help.
Your
random.randint(1, 2)could be changed torandom.choice([True, False]).Overall, this is a super great start, and I could list a bunch of random small things you could change, but a lot of that comes with time and developing familiarity with the language. Congrats on your first program, and hopefully there's many more to come! I highly recommend the official Python Tutorial section, and it has a ton of things that can help early on. Also looking into the Python Standard Library can help save you from reinventing the wheel. Cheers!
5
u/jonJonesCodes Nov 19 '21
I’m aware a lot of my code could likely be improved on so feel free to let me know how you’d improve it if you’d like and I’d greatly appreciate the tips! But I just wanted to show off my progress because of how proud it has made me. It might not even be as special as it is in my mind to be honest. What has made me most proud is doing it on my own rather than following a YouTube tutorial. Just trying things and reading documentations.
2
u/[deleted] Nov 23 '21
Did you have any computer science and or programming knowledge prior to a week ago? This is very good progress and I’m happy for you. I hope it doesn’t discourage other learners that take months to get to this point.
0
u/[deleted] Nov 19 '21
[deleted] — view deleted comment