def string_rev(str): str = str.split() str.reverse() return ' '.join(str) print(string_rev(input("Insert some strings: ")))
Output:
Insert some strings: my python course course python my
100+ Python Pattern Examples