Feb-01-2018, 11:45 PM
(Feb-01-2018, 05:27 AM)wavic Wrote: If the string length is evenstring[len(string)//2 - 1]
is the first of the middle characters andstring[len(string)//2]
is the second. Just calculate the index.
Thank you for your help, took a bit of tinkering and a lot of loud grunts but I did it. This is what if finally figured out.
## Middle-Character def MC(): mc = input('Enter String: ') if len(mc) % 2 == 0: #even print(mc[len(mc) // 2 - 1] + mc[len(mc) // 2]) else: #odd print(mc[len(mc) // 2])