test2~20171216-170304.py 699 B

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. #déclare la variable sentence comme une chaîne de caractères
  4. sentence = "Je vois la vie en rose…"
  5. print("phrase de départ :",sentence)
  6. #converti sentence en liste appelée words
  7. words = sentence.split()
  8. print(words)
  9. # define new word as list
  10. new_word = []
  11. #retirer les a, e, i, o, u et y de chaque mot
  12. for word in words:
  13. word=word.replace("a","")
  14. word=word.replace("e","")
  15. word=word.replace("i","")
  16. word=word.replace("o","")
  17. word=word.replace("u","")
  18. word=word.replace("y","")
  19. print(word)
  20. # add word to new word list
  21. new_word.append(word)
  22. #reformer la phrase
  23. print("phrase sans les voyelles :", " ".join(new_word))