#!/usr/bin/python # -*- coding: utf-8 -*- #déclare la variable sentence comme une chaîne de caractères sentence = "Derniers jours avant noel. -50% sur tout le magasin. Consonnez SVP!" 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("é","") 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) #recomposer la phrase sans les voyelles print("phrase sans les voyelles :", " ".join(new_word)) with open("phrase.txt","w") as destination: destination.write("phrase sans les voyelles :") destination.write(" ".join(new_word))