malheureusement on doit utiliser un fichier texte
Bonjour à tous! J'ai essayer de faire la suite mais je n'y suis pas parvenu.
J'ai essayé ceci mais rien ne s'affiche:
Auriez-vous des solution?
monfichier= open('site.txt','r')
contenu= monfichier.read()
age="a"
while not age.isdigit() or age.isdigit and (int(age)<10 or int(age)>90):
age=str(input("Indiquer l'age: "))
age=int(age)
print("\n Indiquer si vous voulez trouver :\n",
"- La liste des personnes ayant",age,"ans (taper 1)\n",
"- La liste des personnes dont l'age est supérieur à",age,"ans (taper 2)\n",
"- La liste des personnes dont l'age est inférieur à",age,"ans (taper 3)\n")
numero="n"
while not numero.isdigit() or numero.isdigit and (int(numero)<=0 or int(numero)>=4):
numero=str(input("Votre choix est le numéro :"))
numero=int(numero)
if numero==1:
for ligne in monfichier:
mot=ligne.split("*")
if age==mot[3]:
print(mot[0]+" "+mot[1]+" a "+str(mot[3])+" ans")
elif numero==2:
for ligne in monfichier:
mot=ligne.split("*")
if mot[3]<age:
print(mot[0]+" "+mot[1]+" a "+str(mot[3])+" ans")
else:
for ligne in monfichier:
mot=ligne.split("*")
if mot[3]>age:
print(mot[0]+" "+mot[1]+" a "+str(mot[3])+" ans")
site.txt