Skip to content

Instantly share code, notes, and snippets.

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

  • Save GravenilvecTV/9848be3ff531ee7c6d037148dac23f0e to your computer and use it in GitHub Desktop.

Select an option

Save GravenilvecTV/9848be3ff531ee7c6d037148dac23f0e to your computer and use it in GitHub Desktop.
APPRENDRE LE PYTHON #2 ? LES VARIABLES
# recolter une valeur porte monnaie
wallet = int(input("Entrer le nombre d'€ que vous possedez"))
print("Vous avez actuellement", wallet, "euros")
# creer un produit qui aura pour valeur 50
produit = 50
print("Le Produit vaut ", produit, "euros")
# enleve au "wallet" le prix du produit
wallet = wallet - produit
# ou wallet -= produit
# afficher la nouvelle valeur
print("Produit acheté !")
print("Il ne vous reste plus que", wallet, "euros")
@stickamir
Copy link

wallet = int(input("combien d'€ possédez vous ?"))
print("vous avez actuellement",wallet,"€")
produit = 50
print(" vous décidez d'acheter un produit.il vaut ",produit,"€")
cout_total = wallet - produit
if wallet>=produit:
print("vous pouvez acheter ce produit vous avez maintenant ",cout_total,"€")
else:
print("vous n'avez pas assez d'argent pour acheter ce produit ")
print("si vous l'auriez acheté vous seriez endetté de",cout_total,"€")

c'est mon premier projet publié sur github c'est franchement sympa parfait pour débuter

@pape123-sow
Copy link

pape123-sow commented Oct 28, 2025 via email

@stickamir
Copy link

@pape123-sow Franchement, merci ! Je ne m’attendais pas à recevoir un retour positif en moins d’une heure, surtout sur mon premier post !

@Steevedm
Copy link

Capture d'écran 2025-11-16 002934 Capture d'écran 2025-11-16 003104

Je sais pas si c'est bon mais on a le résultat demander, je débute totalement.

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