Skip to content

Instantly share code, notes, and snippets.

@GravenilvecTV
Created November 24, 2018 19:18
Show Gist options
  • Save GravenilvecTV/3c79c09262e83148550410cd8e4e2a24 to your computer and use it in GitHub Desktop.
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, "€")
@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,"€")

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