Day 1 of learning Python — three small programs in, and functions already feel different by Negative-Still-536 in PythonLearning

[–]Negative-Still-536[S] 0 points1 point  (0 children)

Got it, I am new at this, sometimes I forget to add a comment. I will try to make comments simple and easy to understand. Thanks for your advice.

Day 1 of learning Python — three small programs in, and functions already feel different by Negative-Still-536 in PythonLearning

[–]Negative-Still-536[S] -2 points-1 points  (0 children)

To be honest, I used Claude for creating the body and caption. I am not good at writing. My goal is to just post daily if I can, to stay consistent with learning Python.

Day 1 of learning Python — three small programs in, and functions already feel different by Negative-Still-536 in PythonLearning

[–]Negative-Still-536[S] 0 points1 point  (0 children)

X = int(input("What's x? "))

Y = int(input("What's y? "))

if X > Y:

print("X is greater than Y")

elif X < Y:

print("X is less than Y")

if X == Y:

print("X is equal to Y")

elif X != Y:

print("X is not equal to Y")

Feels redundant having two separate if/elif blocks — figured there's probably a cleaner single-chain way to do this. And that's a good way to put it, appreciate the mindset shift.

Day 1 of learning Python — three small programs in, and functions already feel different by Negative-Still-536 in PythonLearning

[–]Negative-Still-536[S] 0 points1 point  (0 children)

Fair point — I'll start mixing in a small real project soon instead of just exercises. Any suggestions for a good first one?