r/PythonLearning • • 13d ago

What do you guys think?

After watching a python full course video on YouTube by BroCode, I made a simple number guessing game in python!

Here's the link to the video: https://youtu.be/ix9cRaBkVe0?si=UiWmP6bm-9MG4B1p

After 12 gruesome hours watching the tutorial i decided to make this to test what I've learned.

What do you guys think?

175 Upvotes

44 comments sorted by

View all comments

3

u/TemperatureProper275 13d ago

I recommend you use type hints when creating methods/functions and return values.

For example in my code:

I know what the parameter types are and what i must return!

0

u/[deleted] 13d ago

[deleted] — view deleted comment

2

u/TemperatureProper275 13d ago

I disagree, type hints are OP. You learn to work better with data types and your inputs/outputs are cleaner.

1

u/burntoutdev8291 13d ago

They only help with IDE integration. I never tried running type checkers like "ty" before

1

u/RegularBother614 13d ago

Unfortunately i can't customize my editor since I'm coding on my phone and there's no setting to customize my editor

1

u/ChaoticHippo 13d ago

This isn't an editor customization - type hints are an optional syntax in Python. They are worth using, but none of your functions have parameters, making them a little less valuable in your situation. They basically let you denote exactly what to expect going into or out of a function, rather than relying solely on implicit typing. For example:

def add(num1, num2):
  return num1+num2

Is totally valid. However:

def add(num1: int, num2: int) -> int:
  return num1+num2

This makes it extremely clear that this takes in 2 integers and returns the integer sum of those two values. This doesn't seem super useful with something this simple, but it gets really useful later for more complicated functions.

1

u/RegularBother614 13d ago

I'm not on a PC and I certainly don't use VScode as seen from the images. I'm on my phone and I only use Coding Python by Kvass Yu, Pyroid 3 by Lider Soft Kz and Acode Free version by Foxbiz Software.

2

u/ChaoticHippo 13d ago

None of what I've typed here requires any form of editor, certainly not VSCode. You could use type hints on pen and paper. It is a syntax choice - as in something that you type.

0

u/TemperatureProper275 13d ago

I use Pycharm on PC, its a python specific IDE.

1

u/RegularBother614 13d ago

I don't have a PC dude 😭 Pycharm is only for PC