Computer Science
What will be the output of the following code — print("100 + 200")
?
- 300
- 100200
- 100 + 200
- 200
Python String Manipulation
1 Like
Answer
100 + 200
Reason — The output of the code print("100 + 200")
will be: 100 + 200
. This is because the code is printing the string "100 + 200" as it is written within double quotes. The arithmetic operation inside the string is not evaluated because it's treated as a part of the string literal, not as an actual expression.
Answered By
2 Likes
Related Questions
Tuples can be nested and can contain other compound objects like lists, dictionaries and other tuples.
Which of the following is not considered a valid identifier in Python ?
- two2
- _main
- hello_rsp1
- 2 hundred
Which amongst the following is a mutable data type in Python ?
- int
- string
- tuple
- list
Which of the following statements are not correct?
(A) An element in a dictionary is a combination of key-value pair.
(B) A tuple is a mutable data type.
(C) We can repeat a key in a dictionary.
(D) clear() function is used to delete the dictionary.
- A, B, C
- B, C, D
- B, C, A
- A, B, C, D