middle picks the character at the halfway index of its argument. Three calls follow, and each answer is shown with a space after it.
def middle(s):
return s[len(s) // 2]
print(middle("abc"), end=" ")
print(middle("ab"), end=" ")
print(middle(""))
What is the result of running this code?Log in to join the discussion.
Loading…