Ad

This function is a one liner that reverses all the words in a string individually.

Code
Diff
  • shuffle = lambda st: " ".join(x[::-1] for x in st.split())
    
    • def shuffle(st):
    • st = st.split(' ')
    • for x in range(0, len(st)):
    • st[x] = list(st[x])
    • st[x].reverse()
    • st[x] = ''.join(st[x])
    • st = ' '.join(st)
    • return st
    • shuffle = lambda st: " ".join(x[::-1] for x in st.split())