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
Science,
3 months ago
Math,
3 months ago
Geography,
3 months ago
Social Sciences,
6 months ago
Math,
11 months ago