5. What will be the output of the expression: print("50"+"70")?
a.50 70
b. 5070
c. 120
Answers
Answered by
42
Answer:
b. 5070
Explanation:
- Using "" assigns the number a string datatype to the number.
- And + performs concatenation i.e joins the text pieces as they are.
- since there is not space in "50" and "70" therefore their concatenation is 5070
Answered by
24
Answer:
5070
Explanation:
When two strings are separated by the addition operator, the resultant output will be those two strings joined into one.
Confusions arise in these cases as the characters in the strings are numbers, and it may be the first instinct of a mind to add the two numbers when they see them separated by the addition operator.
Here's another example:
>>> print("Hello" + "World")
This statement will give this output:
HelloWorld
As you can see, when the addition operator is used between two strings, it forms one whole string by combining the two strings.
Similar questions
Science,
2 months ago
Social Sciences,
2 months ago
Chemistry,
2 months ago
Social Sciences,
4 months ago
Science,
11 months ago
Math,
11 months ago