Advertisement
Stily

Untitled

Feb 18th, 2020
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. sentence = input().split()
  2. new_sentence = []
  3. for word in sentence:
  4. current_word = ''
  5. word=list(word)
  6. num_str=[n for n in word if n.isdigit()]
  7. number=int(''.join(num_str))
  8. word=[i for i in word if i not in num_str]
  9. word[0], word[-1] = word[-1], word[0]
  10. word=''.join(word)
  11. current_word+=(chr(number))+word
  12. new_sentence.append(current_word)
  13.  
  14. for words in new_sentence:
  15. print(words, end=' ')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement