s = "oh my god, I will not fail any course" s_as_l = s.split() print(' '.join(word[::-1] for word in s_as_l))