I am currently studying Python at school. I don't understand what the book is trying to explain and my instructor isn't very helpful. The book gives the following example:
usr_text = input('Enter a string: ')
print()
first_half = usr_text[:len(usr_text)//2]
last_half = usr_text[len(usr_text)//2:]
print('The first half of the string is "{}"'.format(first_half))
print('The second half of the string is "{}"'.format(last_half))
I don't understand what
[:len(usr_text)//2]
&
[len(usr_text)//2:]
does. Would anyone mind explaining what's happening there and why it's used? Thank you!