What will be the data type of the following variable?
A = ‘101’
a. Integer b. String
c. Float d. None of the above
Answers
Answer:
The variable will have a string data type.
Option(b) is correct.
Explanation:
Data Type
A data type is used to define what values will be accepted by the variable. In a programming language like Python, we don't need to tell in adance the data type, our interpreter understands the data type based on the value entered in the variable.
String Data Type
The sequence of characters forms a string. Now you might think about how 101 becomes a string even if it is not a character. Well, 101 is a string because it is entered with single quotes.
So remember, any number that is entered with single quotes or double quotes is treated as String data type in Python.
101 is a numerical but because of the single quotes our interpreter will treat it as an string.
#SPJ3
Answer:
Explanation:
int
integer can be any value