2/25/2018 11:13:29 AM
Shivani Goyal28 Answers
New Answerthey are automatically assigned, it's just how python is made, simple elegant and only requires minimum amount of code, rest Python does for you :)
This is not just in Python. The same is done in VBA for variables by default, in JavaScript, and earlier it was in DBase and its descendants: FoxBase, FoxPro, Clipper.
The variables data type are determined by their value assigned. This way a variable is flexible in its use, such as where an integer may be useful here then a float may be useful there.
Becasuse we asaign a value to a variable and we decide what type of value we give to it
Because Python automatically understands the data type when you assign a value to it and there's no need to determine whether the data type is integer or float or string. For example: A = 7 #No need to write int A B = 7.5 #No need to write float B C = "Hi" #No need to write string C
Once an object is assigned to a variable, you can refer to the object by that name. Ex:x=4 here,x is the variable name that assigned to 4.we can refer variable to get the value assigned to it.
Variables generally have a data type when they are a assigned to a certain value. The data type of variable can be found by the type of value assigning to it. eg:-We calls different variables as numeric variables as they are assigned to numeric value.(n=5.1 , n is a numeric variable as the float value is assigned to it).
I think that the data type in Python is verified by the assignment of a value to the variable, unlike Java
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message