Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. def riocontra(s):
  2.  
  3. rr = ''
  4. words = s.split()
  5.  
  6. consonants = string.ascii_lowercase
  7. for wovel in ['a', 'e', 'i', 'o', 'u']:
  8. consonants = consonants.replace(wovel, '')
  9.  
  10. for word in words:
  11. if len(word) > 3:
  12. input = SonoriPy(word)
  13. out = [input[-1]] + input[:-1]
  14. ret = ''.join(out)
  15. if ret[-1] in consonants:
  16. ret = list(ret)
  17. ulti = ret[-1]
  18. penulti = ret[-2]
  19. ret[-1] = penulti
  20. ret[-2] = ulti
  21. ret = ''.join(ret)
  22. rr += f' {ret}'
  23. else:
  24. rr += f' {word}'
  25. return rr.strip()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement