Why Python is a Strongly Typed Language?
Strongly Typed Language
The programming language is referred to as the Strongly Typed Language when the type of data like Integer, String, Float, etc are predefined. Also every variable or constant must be of the same data type. A variable or a constant are not allowed without its type. As python is a dynamically typed language type of the variable is defines when the code is interpreted. Let’s continue on the question “Why Python is a strongly typed language?”.
If a language is Strongly typed than it should follow some important rule that While the language is compiled or interpreted it must keep track of all the variables and constants that they are assigned to some data-type. In python programing language variables are not declared with the type of variable. But as the code interpreted the interprets keep track of all the type of variable in it.
Hence the variables initializes are assigned to the type of the category they belong it follows the most important rule of being a strongly typed language. And so we can say that the language is strongly typed.
#initialize some variables var1 = 10 var2 = 20.20 var3 = 'PrepInsta' #print type of these variables print(type(var1)) print(type(var2)) print(type(var3))
Output: <class 'int'> <class 'float'> <class 'str'>
Liskov and Zilles
Strongly typed languages are "Whenever an object is passed from a calling function to a called function, its type must be compatible with the type declared in the called function"
FAQ's
Is JavaScript type safe?
Is Java weakly typed?
Why TypeScript is strongly typed?
Prime Course Trailer
Related Banners
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
Get over 200+ course One Subscription
Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others
Login/Signup to comment