For the following Python statement: Msg = ('Good Day') What shall be the data…
2023
For the following Python statement: Msg = ('Good Day') What shall be the data type of Msg?
Answer: D. string — In Python, parentheses alone do not create a tuple. When a single expression is enclosed in parentheses without a trailing comma, it is treated as a string.…
- A.
tuple
- B.
list
- C.
Error in statement
- D.
string
Attempted by 2882 students.
Show answer & explanation
Correct answer: D
In Python, parentheses alone do not create a tuple. When a single expression is enclosed in parentheses without a trailing comma, it is treated as a string. Therefore, ('Good Day') is interpreted as the string "Good Day".
Loading lesson…