- 2
What is the output of this code? x = "Python" print(x[1] + x[4])
please help me
7 Answers
+ 7
https://code.sololearn.com/cXuJ1HK2qyjR/?ref=app
It will output : yo
+ 5
string in some points is like list. And you can refer to the any character in the string by it's corresponding index number. Remember indexing starts with zero not one.
So,
P-0
y-1
t-2
h-3
o-4
n-5
x[1]=y
x[4]=o
and the answer is "yo"
+ 4
x[1] = y
x[4] = o
Output will be 'yo'.
+ 3
x[0]=p
x[1]=y
x[2]=t
x[3]=h
x[4]=o
x[5]=n
print(x[1]+x[4]) => yo
- 1
x[1]=y
x[y]=o
Then output is 'yo'
- 2
What is the output of this code?
x = "Python"
print(x[1] + x[4])
RĂ©ponse c'est yo