Synchro vm + dépôt git

This commit is contained in:
2024-09-16 15:01:28 +02:00
parent 20bd4f5bce
commit f9362c63bc

View File

@@ -1,4 +1,38 @@
nom = "tata"
print(nom)
print("Je m'appell "+ nom + ".")
print("Mon nom c'est bien " + nom)
def demander_nom ():
reponse_nom = ""
while reponse_nom == "":
reponse_nom = input("Quel est ton nom? ")
return reponse_nom
def demander_age(nom_personne):
age_int = 0
while age_int == 0:
age_str = input(nom_personne + " quel est ton age? ")
try:
age_int = int(age_str)
except ValueError:
print ("Vous devez saisir un nombre pour l'age.")
return age_int
def afficher_information_personne(nom,age):
print("Vous vous appelez " + nom + ", vous avez " + str(age) + " ans.")
print("L'année prochaine vous aurez " + str(age + 1) + " ans.")
nom1 = demander_nom()
nom2 = demander_nom()
age1 = demander_age(nom1)
age2 = demander_age(nom2)
afficher_information_personne (nom1,age1)
afficher_information_personne (nom2,age2)
"""print("Vous vous appelez " + nom1 + ", vous avez " + str(age1) + " ans.")
print("L'année prochaine vous aurez " + str(age1 + 1) + " ans.")
print("Vous vous appelez " + nom2 + ", vous avez " + str(age2) + " ans.")
print("L'année prochaine vous aurez " + str(age2 + 1) + " ans.")
print ("Merci, passez une bonne journée")
"""