What are the values of the following expressions?
In each line, assume that:
s = "Hello" t = "World"
s[1] + s[2]
In Python, string indexing starts at 0. Given the string s = "Hello"
, the characters are indexed as follows:
Now, evaluating the expression s[1] + s[2]
:
So, s[1] + s[2]
results in:
'e' + 'l' = 'el'
Therefore, the value of the expression s[1] + s[2]
is 'el'
.