Skip to content

Instantly share code, notes, and snippets.

@GravenilvecTV
Created November 24, 2018 19:18
Show Gist options
  • Select an option

  • Save GravenilvecTV/3c79c09262e83148550410cd8e4e2a24 to your computer and use it in GitHub Desktop.

Select an option

Save GravenilvecTV/3c79c09262e83148550410cd8e4e2a24 to your computer and use it in GitHub Desktop.
APPRENDRE LE PYTHON #3 ? LES CONDITIONS
# Place de cinema
# recolter l'age de la personne "Quel est votre age ?"
age = int(input("Quel est votre age ?"))
# si la personne est mineur -> 7€
if age < 18:
prix_total = 7
# si la personne est majeur -> 12€
else:
prix_total = 12
# ou alors en ternaire
# prix_total = (7, 12)[age < 18]
# souhaitez-vous du pop corn ?
pop_corn_request = input("Souhaitez-vous du pop corn ? (Oui, Non)")
# si oui
if pop_corn_request == "Oui":
prix_total += 5
print("Vous devez payer", prix_total, "€")
@Raiyz25
Copy link

Raiyz25 commented Aug 17, 2025

age = int(input("Quelle est votre âge: ")) tarif_mineur = 7 tarif_majeur = 12 if age < 18: print("Vous allez payer " + str(tarif_mineur) + "€") else: print("Vous allez payer " + str(tarif_majeur) + "€") PopCorn = input("Voulez vous du PopCorn?") if PopCorn == "yes" and (age < 18): print("Le montant total de votre place + les popcorn est de " + str(tarif_mineur + 5)) elif PopCorn == "yes" and (age >= 18): print("Le montant total de votre place + les popcorn est de " + str(tarif_majeur + 5)) elif PopCorn == "no" and (age >= 18): print("Vous avez un total à payer de" + str(tarif_majeur)) else: print("Vous avez un total à payer de" + str(tarif_mineur))

@kazbom
Copy link

kazbom commented Aug 27, 2025

price = 0

age = int(input("Quel âge avez-vous ? "))

price += (12, 7)  [age<18]

pop_corn = str(input("Du pop-corn avec ça ? y/n ")).lower()

price += (5, 0) [pop_corn!="y"]

print (f"Votre total à payer est de {price}€")

@DeusExJunior
Copy link

Voici mon code

Place de cinema

récolter l'age

age = int(input("Bonjour, vous êtes au cinéma. Le prix de la place dépend de votre age. Quel age avez vous ? "))
print("Vous avez {} ans".format(age))

si la personne est mineur -> 7 euros

if age < 18:
prix_place = 7
print("Vous êtes mineur donc vous payez {} euros.".format(prix_place))

si la personne est majeur -> 12 euros

elif age >= 18:
prix_place = 12
print("Vous êtes majeur donc vous payez {} euros pour la place".format(prix_place))

souhaitez-vous du pop corn ?

popcorn = input("Souhaitez vous du popcorn ? (oui/non)")
if popcorn == "oui":
print("Vous allez payer 5 euros en plus")
# si oui -> +5 euros
prix_place += 5
# afficher le prix total à payer
print("Vous allez payer {} euros au total".format(prix_place))
elif popcorn == "non":
# afficher le prix total à payer
print("Vous ne prendrez pas de popcorn, vous payerez donc {} euros au total".format(prix_place))
else:
print("Réponds par oui ou non idiot, allez recommence !")

@stickamir
Copy link

prix_final = 0
age = int(input("quel est votre age ? "))
if age < 18 : #si l'age est plus petit que 18
print("tu devras payer 7 $")#écrit tu devras payer 7 $")#
prix_final += 7 #ajoute 7 au prix final
else:
print("tu devras payer 12 $")
prix_final += 12#ajoute 12 au prix final
popcorn = input("souhaitez vous du pop corn ?")
if popcorn == "oui":
print("tu seras facturé de 5 $")
prix_final+= 5#on enlève 5 au prix final
else:
print("ok tu n'auras pas de popcorn")
prix_final+= 0#n'ajoute rien si on ne prend pas de pop corn
print("ton prix final seras de "+str(prix_final)+"$")

@Steevedm
Copy link

Capture d'écran 2025-11-16 180606 Capture d'écran 2025-11-16 180651 Capture d'écran 2025-11-16 180709 Capture d'écran 2025-11-16 180808 Capture d'écran 2025-11-16 180849

@chez-drac
Copy link

Screenshot_2025-11-23-10-51-07-443_com kvassyu coding py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment