Question 1
Write a function reverse_first_half(s) that returns a new string in which the first half of s is reversed and the second half is left as it is. The first half is the first len(s) // 2 characters; so when s has an odd length, its middle character belongs to the second half.
NOTE: This is a function type question, you don't have to take input or print the output, just have to complete the required function definition.
Example
reverse_first_half("abcdef") -> 'cbadef'
reverse_first_half("python") -> 'typhon'
Your task
Implement this function:
def reverse_first_half(s: str) -> str:
Write the function only — the arguments are read for you and the return value is printed automatically.
Arguments arrive as one Python literal per line, in this order: s.
Example
Input
"abcdef"
Output
'cbadef'