What is the output of this code? x = "Python" print(x[1] + x[4]) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

What is the output of this code? x = "Python" print(x[1] + x[4])

please help me

17th Apr 2021, 3:30 AM
Rakesh Kotagi
Rakesh Kotagi - avatar
7 Answers
17th Apr 2021, 3:31 AM
Kǟrɨsɦmǟ ❥
Kǟrɨsɦmǟ ❥ - avatar
+ 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"
17th Apr 2021, 4:01 AM
Shadoff
Shadoff - avatar
+ 4
x[1] = y x[4] = o Output will be 'yo'.
17th Apr 2021, 4:17 AM
Scarlet Witch
Scarlet Witch - avatar
+ 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
17th Apr 2021, 4:33 AM
Ahmed Azami Hassani
Ahmed Azami Hassani - avatar
- 1
x[1]=y x[y]=o Then output is 'yo'
18th Apr 2021, 2:23 AM
Rajeev kumar
Rajeev kumar - avatar
- 2
What is the output of this code? x = "Python" print(x[1] + x[4]) Réponse c'est yo
4th Aug 2021, 6:55 PM
MBOUBA SOUBEYE Denis
MBOUBA SOUBEYE Denis - avatar