Computer Science, asked by moon123494, 4 months ago

5. What will be the output of the expression: print("50"+"70")?
a.50 70
b. 5070
c. 120

Answers

Answered by allysia
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 lakshyagaur15
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