I'm doing a lab to split an odd string and print out first half, middle char, second half. Code is working fine, except I can't get rid of the middle char when printing out the second half. Here it is:
str = input("Enter an odd length string: ")
length = len(str)
middle = length // 2
half1 = str[ : middle ]
half2 = str[middle : ]
print("Middle character:",str[middle])
print("First half:",half1)
print("Second half:",half2)
The result is:
Enter an odd length string: Fortune favors the bold
Middle character: o
First half: Fortune fav
Second half: ors the bold
It is wrong because of that 'o'...
Any clues?
Thanks a lot.