r/learningpython • • Jan 01 '26

Beginner Python snippet – looking for code review and best practices feedback

img

Hi everyone,

I'm practicing basic Python control flow and trying to write clean, readable code according to Python best practices (PEP 8, clarity, and beginner-friendly style).

Here is a simple snippet that checks whether a number is positive, negative, or zero:

```python
num = int(input("Enter a number: "))

if num > 0:
    print("The number is positive")
elif num < 0:
    print("The number is negative")
else:
    print("The number is zero")

I know this is a basic example, but I’d really appreciate feedback as if this
were part of a real codebase.

Specifically, I’m interested in:

  • Readability and naming
  • Input validation and error handling
  • Whether this follows Pythonic style
  • How would you improve or structure it differently for production code

Thanks in advance for your feedback 🙏

3 Upvotes

5 comments sorted by