5 Réponses
+ 4
The 'literal' of the value is used for that.
If you write a bunch of digits, Python knows it's supposed to be an int.
If there's a dot in it, Python knows it's a float.
If there's quotation marks left and right of it, Python knows you want a string.
And so on, each of the built-in types has their own distinguishable way of writing a value.
+ 4
before executing, the script are broken into Token. This token has identifier of what they are
x = 57
x is identifier
= is assignment operator
57 is number
So what ASSIGNED into IDENTIFIER x again ? Oh 57, a NUMBER
+ 3
It has built in code that will help machine to know about data type in python.
That why it is popular language.
+ 2
It uses duck typing, also known as dynamic typing, which defines the data type at runtime, so user is not supposed to mention the data type himself. Interpreter itself identifies what type the variable should be. It also helps in changing the type of the variable to another during runtime