Stuck on python question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Stuck on python question

I am stuck on a problem on beginner python problem for string functions, the problem is as follows Fill in the blanks to output the second word of the given string 'x'. words = x.split(' ') res = words[] print(res) I already answered the first two problems but I need to know what to for the words[]

10th Jan 2022, 11:12 PM
Parker Demirjian
2 Answers
+ 1
It's indexing. You need to put the index of the second value of the list into the brackets. Hint: indexing starts at 0
10th Jan 2022, 11:22 PM
Slick
Slick - avatar
0
words = x.split(' ') res = words[1] print (res) This will print the second word of the string 'x'.
8th Nov 2022, 5:27 AM
Shivam Diwakar