A variable is just a container for data, which help store user data. the python provides the different data-type. Here we starting variable declare on basically. if you are basic knowledge about the python n programming language then you easily understand this tutorial.
Simple variable output is
myrollno=12 print(myrollno)
12
now suppose our program is running and we need to update the value inside this variable. We can change this value of my age simply by assigning a new value to it say with myrollno equals 33.
myrollno=33 print(myrollno)
output is 33 value is updated on when the program is run.
And everyone knows python is power full programming language, for example in the print function we are also doing the calculation on the runtime environment.
print(myrollno/2)
or you can update like this
myrollno= myrollno + 1
Datatype
we’ll know different types of data like text, image, videos, sound. etc, but python has categorized this type of data i.e different kinds of data like text or decimal numbers and whole numbers will have a different category. That means they will have a different data type. Every programming languages define the different type of datatype format for doing a better operation on particular processes. For example, we need to add to value then it must numeric format. In programming languages confirm that before operation or processing variable datatype is the same.
The python provides the type function for the show variable or value data type, when we know about variable datatype then we easily handle the program.
Type(12)
output: int
type(33.5)
Output: float
type(‘python’)
output: str
type(myrollno)
output: int
the python provides better storing feature like an array and list this time these variables are going to be containing lots of data instead of just a single number or a single piece of text. That means we're going to introduce you to collections data frames and series.
Lists
In machine learning and data science, we often need to work with lists. assigning a single value to a single variable like this is that we have a single variable that actually contains lots of data and that variable will represent a collection one of the most common types of collections that you'll encounter is the list. The list can able to containing or supporting datatype in a single value.
For example
rollno=[12,23,1,12,3]
type(rollno)
output : list
normally lists index start with ‘0’ location. Python provides a location for data allocation in the list type of data also doing insertion, update and delete operation.
rollno[2]
output: 1
Array
the data in an array must be of the same type so an array must be all numbers or all strings. Array is more powerful as compare to the list.