11.Consider python statement : X=eval(input(“Enter data”))
What will be the data type of X if the user input is:
i) [1,3,53] ii) 45
Answers
Answered by
0
Answer:
Will u insert the question in a paper?????
Answered by
8
Answer:
(I) list
(II) int
Explanation:
Eval function evaluates the value of the string. In other words it identifies the data type of the string.
Example :
a = “13”
print(eval(a))
Output:
Data type of variable a is string but then when eval is used it evaluated the value of a which is 13 and it is integer so it returns
Advantages of Eval:
1. Helps in identification of data type
Disadvantages:
1. Eval function can only be used for string, not any other data type.
Ex: eval(13) returns error since 13 is not string
eval(“13”) returns int since 13 in “” is string .
Anything in “” Is a string
Hope this helps you. Please Mark this answer brainliest if you find this answer helpful :)
(I) list
(II) int
Explanation:
Eval function evaluates the value of the string. In other words it identifies the data type of the string.
Example :
a = “13”
print(eval(a))
Output:
Data type of variable a is string but then when eval is used it evaluated the value of a which is 13 and it is integer so it returns
Advantages of Eval:
1. Helps in identification of data type
Disadvantages:
1. Eval function can only be used for string, not any other data type.
Ex: eval(13) returns error since 13 is not string
eval(“13”) returns int since 13 in “” is string .
Anything in “” Is a string
Hope this helps you. Please Mark this answer brainliest if you find this answer helpful :)
Similar questions
Math,
2 months ago
Political Science,
2 months ago
Music,
2 months ago
Social Sciences,
5 months ago
Math,
10 months ago