Is there a way to split a string into 2 equal halves without using a loop in Python?
Whoever is suggesting string[:len(string)/2], string[len(string)/2 is not keeping odd length strings in mind!
This works perfectly. Verified on edx.
first_half = s[:len(s)//2]
second_half = s[len(s)//2:]