+1

Why value of "x" will be 70 ?

>>> x="7" >>> x=x+"0" >>> print(x) 70

8/11/2019 12:47:57 AM

Twiddle

2 Answers

New Answer

+8

Literals within quotes are string literals. The addition operator performs concatenation on strings. In this case, "7" is concatenated with "0" and assigned to x. Printing x will result in "70" being printed.

+7

Here x = "7" 7 is string in this syntax x=x+"0" Here x is string which value is 7 and 0 also string. When we add the string 7 and 0 Output will be 70.