1234567891011121314151617181920212223242526272829 |
- #!/usr/bin/python
- # -*- coding: utf-8 -*-
- #déclare la variable sentence comme une chaîne de caractères
- sentence = "Je vois la vie en rose…"
- print("phrase de départ :",sentence)
- #converti sentence en liste appelée words
- words = sentence.split()
- print(words)
- # define new word as list
- new_word = []
- #retirer les a, e, i, o, u et y de chaque mot
- for word in words:
- word=word.replace("a","")
- word=word.replace("e","")
- word=word.replace("i","")
- word=word.replace("o","")
- word=word.replace("u","")
- word=word.replace("y","")
- print(word)
- # add word to new word list
- new_word.append(word)
- #reformer la phrase
- print("phrase sans les voyelles :", " ".join(new_word))
|