Advertisement
Guest User

7

a guest
Feb 16th, 2020
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. coded_list = input().split()
  2.  
  3. for code in coded_list:
  4.     new_word = chr(int("".join([num for num in code if num.isdigit()])))
  5.     the_rest = [letter for letter in code if letter.isalpha()]
  6.     if len(the_rest) > 1:
  7.         the_rest[0], the_rest[-1] = the_rest[-1], the_rest[0]
  8.         new_word += "".join(the_rest)
  9.     else:
  10.         new_word += the_rest[0]
  11.     print(new_word, end=" ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement