I was surfing YouTube and I came across these strange Python statements
n: int xyz
n1: str “Hello World”
What is “n:”?
I Googled it but didn’t find anything about them.
Using Python 3.11.
I was surfing YouTube and I came across these strange Python statements
n: int xyz
n1: str “Hello World”
What is “n:”?
I Googled it but didn’t find anything about them.
Using Python 3.11.
They look like type annotations for additional static type checking tools. But they also need an assignment operator =
after the type and before the value onthe right, to be valid Python syntax.