@@ -0,0 +1,48 @@ | |||
import random | |||
def read_words(): | |||
stream = open("noms.txt") | |||
words = stream.read().splitlines() | |||
return words | |||
def choose_word(words): | |||
n = len(words) | |||
index = random.randint(0, n-1) | |||
return words[index] | |||
def has_won(word, letters): | |||
return set(word) == letters | |||
def display_hint(word, letters): | |||
for letter in word: | |||
if letter in letters: | |||
print(letter, end="") | |||
else: | |||
print("_", end="") | |||
print("") | |||
def main(): | |||
words = read_words() | |||
word = choose_word(words) | |||
print(word) | |||
letters = set() | |||
display_hint(word, letters) | |||
while True: | |||
new_letter = input() | |||
letters.add(new_letter) | |||
display_hint(word, letters) | |||
if has_won(word, letters): | |||
print("Gagné") | |||
return | |||
if __name__ == "__main__": | |||
main() |
@@ -0,0 +1,11 @@ | |||
airports = { | |||
"ORY": "Orly", | |||
"LAX": "Los Angeles", | |||
} | |||
print("Where are you going?") | |||
a = input().upper() | |||
if a in airports: | |||
print(airports[a]) | |||
else: | |||
print(a, "not found") |
@@ -31,9 +31,6 @@ def main(): | |||
scores[word] += 1 | |||
stream.close() | |||
top = sorted(scores.items(), key=get_value, reverse=True) | |||
for word, count in top[0:10]: | |||
print(count, word) | |||
if __name__ == "__main__": |
@@ -0,0 +1,241 @@ | |||
accord | |||
affaire | |||
agent | |||
aide | |||
amour | |||
appel | |||
arbre | |||
argent | |||
arme | |||
attention | |||
avenir | |||
avion | |||
avis | |||
balle | |||
bateau | |||
besoin | |||
bois | |||
bonheur | |||
bonjour | |||
bord | |||
bouche | |||
boulot | |||
bout | |||
bras | |||
bruit | |||
bureau | |||
camp | |||
capitaine | |||
carte | |||
cause | |||
chambre | |||
chance | |||
chat | |||
chef | |||
chemin | |||
cheval | |||
cheveu | |||
chien | |||
choix | |||
chose | |||
ciel | |||
classe | |||
client | |||
coin | |||
colonel | |||
compte | |||
confiance | |||
copain | |||
corps | |||
couleur | |||
coup | |||
cour | |||
courant | |||
cours | |||
cuisine | |||
dame | |||
dent | |||
dieu | |||
docteur | |||
doigt | |||
dollar | |||
doute | |||
droit | |||
droite | |||
effet | |||
endroit | |||
enfant | |||
ennemi | |||
envie | |||
erreur | |||
escalier | |||
esprit | |||
exemple | |||
face | |||
faim | |||
fait | |||
famille | |||
faute | |||
femme | |||
fille | |||
film | |||
fils | |||
fleur | |||
flic | |||
fois | |||
fond | |||
force | |||
forme | |||
front | |||
garde | |||
gars | |||
gauche | |||
genre | |||
gens | |||
geste | |||
gosse | |||
gouvernement | |||
grand | |||
groupe | |||
guerre | |||
gueule | |||
habitude | |||
haut | |||
heure | |||
histoire | |||
homme | |||
honneur | |||
image | |||
impression | |||
instant | |||
jambe | |||
jardin | |||
joie | |||
jour | |||
journal | |||
langue | |||
lettre | |||
lieu | |||
ligne | |||
livre | |||
long | |||
madame | |||
main | |||
maison | |||
maman | |||
marche | |||
mari | |||
mariage | |||
matin | |||
merci | |||
merde | |||
milieu | |||
million | |||
minute | |||
mois | |||
moment | |||
monde | |||
monsieur | |||
mort | |||
mouvement | |||
moyen | |||
musique | |||
noir | |||
nouveau | |||
nuit | |||
odeur | |||
oeil | |||
oiseau | |||
ombre | |||
oncle | |||
ordre | |||
oreille | |||
paix | |||
papa | |||
papier | |||
parent | |||
parole | |||
part | |||
partie | |||
passage | |||
patron | |||
pays | |||
peau | |||
peine | |||
personne | |||
petit | |||
peuple | |||
peur | |||
photo | |||
pied | |||
pierre | |||
place | |||
plaisir | |||
plan | |||
poche | |||
point | |||
police | |||
porte | |||
pouvoir | |||
premier | |||
prince | |||
prison | |||
prix | |||
professeur | |||
propos | |||
putain | |||
quartier | |||
question | |||
raison | |||
rapport | |||
regard | |||
reste | |||
retard | |||
retour | |||
revoir | |||
robe | |||
route | |||
salle | |||
salut | |||
sang | |||
seconde | |||
secret | |||
seigneur | |||
semaine | |||
sens | |||
sentiment | |||
service | |||
seul | |||
signe | |||
silence | |||
situation | |||
soeur | |||
soir | |||
soldat | |||
soleil | |||
sorte | |||
sourire | |||
souvenir | |||
suite | |||
sujet | |||
table | |||
temps | |||
terre | |||
tour | |||
tout | |||
train | |||
travail | |||
travers | |||
trou | |||
truc | |||
type | |||
vent | |||
ventre | |||
verre | |||
vieux | |||
village | |||
ville | |||
visage | |||
voiture | |||
voix | |||
voyage |