In this tutorial, we will learn about Variables and Data Types in Python. If you have ever learned any programming language than you would have a clear idea about variables and data types. But for those who never learn any programming language before, Variable like containers that contain values and values can change throughout the program. For instance, if you want to add two numbers then you can store those two values in variables and then you can save the addition of those variables in the third variable. Python is totally Object Oriented programming language. It means you do not have to declare every variable before using it. Because every variable in Python is an Object. In this tutorial, we will learn about five kinds of data types.
Data Types in Python:
Numeric Variables: – This kind of data types are used to store numeric type data. Python supports these four numerical types:
- int (signed integers)
- long (long integers, they can also be used to represented octal and hexadecimal)
- float (floating-point values)
- complex (complex numbers)
String in Python: – String is a collection of characters. Strings can contain alphabets, numeric and special characters. Click Here to Learn String in Detail
List in Python: – List is similar to arrays except for one difference. The list can contain different kind of data(integer, string, object) in it. In the list, we can elements according to index number and we can fetch elements from the list using index numbers. Click Here to Learn List in Detail
Tuple in Python: – Tuple is the same as List except one difference Tuples are immutable. Once we assigned an element to Tuple we can not change it. We can fetch elements from Tuple using index numbers. Click Here to Learn Tuple in Detail
Dictionary: – Python’s dictionaries are kind of hash table type. They work like associative arrays.