Indexing and Slicing of Strings and Capturing Inputs in Python