Computer Science, asked by rajeshyaddalapudi143, 5 hours ago

Given strings s and t, ``s = "Hello"`` and ``t = "World"`` and an integer r, ``r = 2``. What is the output of s * r + s * t?

Answers

Answered by ArshiaAishani2008
1

Language using : Python Programming.

Program :

s = "Hello"

t = "World"

r = 2

print( s * r + s * t )

Output : RAISES AN ERROR.

TypeError: can't multiply sequence by non-int of type 'str'

Reason :

s * r gives HelloHello as the string 'Hello' which is in the variable s is printed for r times (r contains 2)

But, when it comes to s * t, the values present in both variables are of type string. A string can't be multiplied with another string. So, it raises a TypeError

Plz mark me as the brainliest  

Similar questions