commited all contents created by participants
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
#!/usr/bin/python
|
||||
# this is a shebang: https://en.wikipedia.org/wiki/Shebang_%28Unix%29
|
||||
import random
|
||||
|
||||
#prefixes = prefixe1+ prefixe2+ prefixe3+ prefixe4 : chaîne de caractère / phrase
|
||||
#print ( type(nom_du_variable)) :pour savoir quel type d'objet
|
||||
prefixes = [
|
||||
"MONO-",
|
||||
"UNI-",
|
||||
"ANTI-",
|
||||
"SUB-",
|
||||
"CYBER-",
|
||||
"SUB-",
|
||||
"PARA-",
|
||||
"AUTO-",
|
||||
"POST-",
|
||||
"INTER-",
|
||||
"HOMO-"
|
||||
]
|
||||
print (prefixes)
|
||||
#jusque là c'est bon
|
||||
|
||||
#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)
|
||||
nouvelle_phrase = []
|
||||
sortie = ''
|
||||
lettres_seules = []
|
||||
longueur_mini = 4
|
||||
|
||||
mots = phrase.split()
|
||||
print("réplique séparé:",mots)
|
||||
|
||||
for mot in mots:
|
||||
# si le mot est assez long
|
||||
if ( len(mot) >= longueur_mini ) :
|
||||
print('mot à préfixer : ' + mot)
|
||||
nouvelle_phrase.append( random.choice( prefixes ) + mot )
|
||||
else:
|
||||
nouvelle_phrase.append( mot )
|
||||
|
||||
# lettres_seules = list(mot)
|
||||
# print("tentative de lettre:", lettres_seules)
|
||||
# print (len(mot))
|
||||
# length = len(mot)
|
||||
# if length >= 4 :
|
||||
print(nouvelle_phrase)
|
||||
print('---')
|
||||
for mot in nouvelle_phrase:
|
||||
sortie = sortie + mot + ' '
|
||||
|
||||
print(sortie)
|
||||
|
||||
#for mot in mots:
|
||||
#length >= 4= list (mot)
|
||||
|
||||
|
||||
# mots_length4= length >= 4= list (mot)
|
||||
# print ("listes mots choisis:", mots_length4)
|
||||
#
|
||||
# nouveau_mot= prefixe+mot
|
||||
# print(nouveau_mot)
|
||||
# nouvelle_phrase.append(nouveau_mot)
|
||||
|
||||
#len(mot) : "combien de lettres compose chaque mot?"
|
||||
#length = len(mot) : "LA LONGUEUR DU MOT"
|
||||
#if length >= 4 : "si mon mot est plus grand que 4..."
|
||||
#print (length, mot) "... me le montrer" : rajouter un script dans le script pour l'ensemble des actions; trouver, déinir, classer...
|
||||
|
||||
|
||||
#définir la liste de mot correspondante:
|
||||
#c'est devenu les mots de plus de ' lettres'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#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
|
||||
|
||||
#pour export
|
||||
#with open('export.txt','w')as f:
|
||||
#f.write(dictee_genetic)
|
||||
Reference in New Issue
Block a user