by CodeChum Admin
You already know how to access the middle value of a certain string using index positions, right? Then let's put your learnings to practice.
Make a program that shall input a long string that contains an odd number of individual strings separated by comma. Afterwards, input the string that's located in the middle index position.
Let's do this.
Input
A line containing a string separated by a comma.
Python,is,fun
Output
A line containing a string.
is
lst = input().split(',')
print(lst[len(lst) // 2])
Comments
Leave a comment