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, "€")
@Pepou1
Copy link

Pepou1 commented Jan 21, 2025

#Exo place de ciné

age = int(input("Quel est votre age :"))
if age < 18:
price = 7
elif age >= 18:
price = 12

pop_corn_demande = input("Souhaitez-vous du pop corn ? (Oui, Non)").strip().lower()
if pop_corn_demande== "oui":
price + 5

print("Vous devez payer", price, "$")

@kashcrea
Copy link

print("BIENVENU")
name = input("Entrer votre nom ")
age = int(input("Entrer votre age? "))
popcorn = 5

if age < 18:
ticket = 7
print("Mr " + name + " vous etes mineur, le ticket est de 7$ ")

else:
ticket = 15
print("Mr " + name + " vous etes majeur, le ticket est de 15$")

choix = input("Souhaitez vous du popcorn? Oui ou non ? ")
if choix == "non":
print("Prix total est de " + str(ticket) + " $")

else:

prix_total = ticket + popcorn
# print("Prix total est de " + str(prix_total) + " $")
print("Prix total est de {}$".format(prix_total))

@OenaymeTheBright
Copy link

print("BIENVENU DANS VOTRE CINEMA PREFERER 'CINEKING'")

mineur = 7
majeur = 12
popcorn = 5

age = int(input("Quel age avez vous ? : ")
pop = input("Voulez vous du popcorn ? (o/n) : ")

if age >=18 and pop == "o":
print("cela vous fera ", majeur + popcorn, " euro")
print("Bonne séance !!!")
elif age >= 18 and pop == "n":
print("cela vous fera ", majeur, " euro")
print("Bonne séance")

if age < 18 and pop == "o":
print("cela vous fera ", mineur + popcorn, " euro")
print("Bonne séance !!!")
elif age < 18 and pop == "n":
print("cela vous fera ", mineur, " euro")
print("Bonne séance !!!")

@Yvan-Ossey
Copy link

age_de_la_personne = int(input("Quel est votre age ? "))
if age_de_la_personne < 18 :
prix_total = 7
print("Vous devez payer 7 euros")
else :
prix_total = 12
print("Vous devez payer 12 euros")
pop_corn_proposition = input("Voulez-vous du pop corn ? (Oui/Non)")
if pop_corn_proposition == "Oui":
prix_total += 5
print("Vous devez payer maintenant ", prix_total, "euros")

@Sborjah
Copy link

Sborjah commented Apr 1, 2025

age_personne = (input("Quel âge avez-vous ? "))
tarif_reduit = 7
tarif_plein = 12
print("vous avez", age_personne, "ans")

if age_personne < str(18):
    print("Vous avez droit au tarif réduit")
    print("Le prix de la place est de", tarif_reduit, "Euros")
else:
    print("Place adulte")
    print("Le prix sera de", tarif_plein, "Euros")

pop_corn = input('Souhaitez vous du pop corn ? (supplément de 5 euros): ')

if  pop_corn.lower() == "oui" and age_personne < str(18):
    print(f"Cela vous fera un total de {tarif_reduit + 5} euros")
elif pop_corn.lower() == "oui" and age_personne >= str(18):
    print(f"Cela vous fera un total de {tarif_plein + 5} euros")
elif pop_corn.lower() == "non" and age_personne < str(18):
    print(f"Cela vous fear un total de {tarif_reduit} euros")

else:
    pop_corn.lower() == "non" >= age_personne >= str(18)
    print(f"Cela vous fear un total de  {tarif_plein} euros")      

@Elias584
Copy link

def cinema():
price=0
age= int(input("entrez votre age svp: "))
popcorn= input("voulez vous également du popcorn: ")
if age<18 and popcorn == "oui":
price=price+5+5
elif age<18 and popcorn == "non":
price+=5
elif age>=18 and popcorn == "oui":
price=price+7+5
else:
price+=7
print("monsieur passer à la caisse et donnez une somme de: ", price, "£")
print("nous vous remerçions pour cet achat")
if 0==0:
print(cinema())

@lukunfr
Copy link

lukunfr commented Apr 11, 2025

Moi c'est ... un peu cafouillon mais bon. ca marche ;)

#place de cinéma
#récolter l'age de la personne

place_maj= 12
place_min= 7

age = int(input("Quelle est votre âge? : "))

#si la personne est mineur 7€
if age < 18:
print(f"La place coûte : {place_min}€")

#si la personne est majeur 12€

elif age >= 18:
print(f"La place coûte : {place_maj}€")

#souhaitez-vous du popcorn?
popcorn = 5
answer = str(input("Souhaité vous du popcorn (5€)? [o][n] : "))

#si oui 5€
#Majeur
if answer == "o":
place_maj += popcorn

#Mineur
if answer == "o":
place_min += popcorn

#afficher le résumer de la commande:
if answer == "o" and age < 18:
print(f"Le total à payé pour une place de {age}ans avec des popcorns (à {popcorn}€) est de : {place_min}€")

elif answer == "n" and age < 18:
print(f"Le total à payé pour une place de {age}ans sans des popcorns (à {popcorn}€) est de : {place_min}€")

elif answer == "o" and age >= 18:
print(f"Le total à payé pour une place de {age}ans avec des popcorns ({popcorn}) est de : {place_maj}€")

elif answer == "n" and age >= 18:
print(f"Le total à payé pour une place de {age}ans sans des popcorns (à {popcorn}€) est de : {place_maj}€")

@Hevixx
Copy link

Hevixx commented Apr 26, 2025

client_age = int(input("Quel est votre age ? "))

if client_age <=17:
    prix_total = 7
    print("Le prix sera de 7€")
else:
    prix_total = 12
    print("Le prix sera de 12€")

pop_corn_request = input("Souhaitez vous du pop-corn (yes/no) ? ")
if pop_corn_request == "yes":
    prix_total += 5
    print("Le prix total avec pop-corn sera de", prix_total, "€")
else:
    pop_corn_request == "no"
    print("Le prix total est de", prix_total, "€")

@MinouPY
Copy link

MinouPY commented Jul 14, 2025

age = int(input("Quel est votre age ?"))
popcorn = input("Souhaitez-vous du popcorn ?")
billet_adulte = 12
billet_mineur = 7

if age >= 18:
print("Votre billet coutera ", billet_adulte, "€")
prix_billet = billet_adulte
else:
print("Votre billet coutera ",billet_mineur,"€")
prix_billet = billet_mineur

if popcorn.capitalize() == "Oui":
nbr_popcorn = int(input("Combien en voulez vous ?"))
total = nbr * 5 + prix
print("Votre total est de ",total,"€")
else:
print("Votre total est de ",prix_billet,"€")

@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