In this video, I have explained how to take real time inputs from user and store it a variable. I have also explained the concept of type casting and converting the data type from one form to another. I have explained why type casting is important in string and integers. This video covers basics concept explained in earlier videos. I recommend you to see my previous videos before watching this video.

INPUT FROM USER AND STORE IT IN VARIABLE:

We have discussed in earlier video and blog regarding variables and multiple assignments. Now let’s move on with taking real time inputs from user and storing it in a variable.

Name = input(“Enter the Name : ”)

This function is used to ask real time data from user and stores it in the variable defined as Name. This function takes the value in string. This means when you give input as a numeric value, it also consider it as a string input and you can access it as I have explained in video. To consider this string as numeric value or integer, we need to type cast the taken input as shown.

Age = int(input(“Enter your age :”))

This function will type cast your string into an integer value.

Type Casting:  In simple words, it means conversion of data type. To make use of programming approach in day to day life, conversion of data type is very useful. As explained earlier input() function considers the value in string but if we need to convert it into an integer type casting is required.