Added python code for handling user input