Given a string of even length, return the first half. So the string “WooHoo” yields “Woo”.
first_half(‘WooHoo’) → ‘Woo’
first_half(‘HelloThere’) → ‘Hello’
first_half(‘abcdef’) → ‘abc’
def first_half(str):n = len(str)/2return str[:n]
Expected Run
first_half(‘WooHoo’) → ‘Woo’ ‘Woo’ OK
first_half(‘HelloThere’) → ‘Hello’ ‘Hello’ OK
first_half(‘abcdef’) → ‘abc’ ‘abc’ OK
first_half(‘ab’) → ‘a’ ‘a’ OK
first_half(‘’) → ‘’ ‘’ OK
first_half(‘0123456789’) → ‘01234’ ‘01234’ OK
first_half(‘kitten’) → ‘kit’ ‘kit’ OK
other tests
OK
All Correct