I have started programming recently and I got confused when I learnt about data types. Why do we have/need datatypes?
Also languages like Python don’t have data types making themm much simpler to learn. Why do languages like C or C++ have datatypes then?
I have started programming recently and I got confused when I learnt about data
Share
The data type of a variable determines what kind of data it can store and what possible values it may take. It also help in determining what type of operations can be performed on the variable.
It is wrong to say that Python doesn’t have datatypes. Even in Python every value has a datatype, but you don’t always need to declare the datatype of the variables. Based on each variable’s original assignment, Python figures out what type it is and keeps track of that internally.