From health tips to tech hacks, find it all on IDNLearn.com. Get the information you need from our community of experts, who provide detailed and trustworthy answers.
Answer:
variable = input("Enter some text: ")
midIndex = (len(variable) // 2)
midFix = variable[midIndex-1:midIndex+2]
print('Length is:', len(variable))
print('Middle index is:', midIndex)
print('Midfix of 3 is:', midFix)
Explanation:
You will want to do integer division here (//)
Also, keep in mind that the very first character of the string has index 0, which is why the midFix runs from midIndex-1 to midIndex+2