Python code for my word switching