50 lines
1.1 KiB
Python
50 lines
1.1 KiB
Python
#!/usr/bin/python
|
|
# this is a shebang: https://en.wikipedia.org/wiki/Shebang_%28Unix%29
|
|
import random
|
|
|
|
prefixe1 = "MONO-"
|
|
prefixe2 = "UNI-"
|
|
prefixe3 = "ANTI-"
|
|
prefixe4 = "SUB-"
|
|
|
|
#prefixes = prefixe1+ prefixe2+ prefixe3+ prefixe4 : chaîne de caractère / phrase
|
|
#print ( type(nom_du_variable)) :pour savoir quel type d'objet
|
|
prefixes = [prefixe1, prefixe2, prefixe3, prefixe4]
|
|
print (prefixes)
|
|
|
|
#print (prefixe1)
|
|
#intégrer une sentence
|
|
#myfile = open ("which_spites.txt", 'r')
|
|
#sentence = myfile.read()
|
|
#myfile.close()
|
|
|
|
phrase = "And that which spites me more than all these wants- He does it under name of perfect love"
|
|
print("1ere réplique:", phrase)
|
|
|
|
#définir la liste de mot correspondante
|
|
nouvelle_phrase = []
|
|
|
|
mots = phrase.split()
|
|
print(mots)
|
|
for mot in mots:
|
|
prefixe =random.choice(prefixes)
|
|
print("prefixe aléatoire:", prefixe)
|
|
|
|
nouveau_mot= prefixe+mot
|
|
print(nouveau_mot)
|
|
nouvelle_phrase.append(nouveau_mot)
|
|
|
|
print(nouvelle_phrase)
|
|
|
|
print("phrase mono-", " ".join(nouvelle_phrase))
|
|
|
|
|
|
|
|
#séparer chaque mot
|
|
|
|
|
|
|
|
#choix d'un prefixe parmis le stack de prefixe
|
|
|
|
#indiquer au prefixe qu'il precede le mot
|