test.py

Created by bhenry1

Created on May 12, 2024

1002 Bytes

Ce programme teste l’utilisation des fonctions de la bibliothèque pourcentage.


def somme(initial, raison, nombre) :
  return initial*(1 - raison**nombre)/(1-raison)

def somme(initial, raison, nombre) :
  s = 0
  u = initial
  for i in range(n) :
    u = u * raison
    s = s + u
  return s

from pourcentage import *

print(partie(200, 15/100))
m = partie(250, 0.45)
print("un fromage de 250g à 45% de M\nG. contient", m,"g de MG")

print(proportion(200, 30))
p = proportion(1500, 285) * 100
print("un fromage de 1,5 kg contenant\n285 g de MG a", p,"% de MG")

print(ensemble(0.15, 30))
p = ensemble(0.18, 135)
print("un fromage à 18% de M.G. avec\n135g de MG, pèse", p, "g")

print(arrive(200, -15/100))
pttc = arrive(600, +5.5/100)
print("Avec une TVA à 5,5% et un PHT\nde 600, le PTTC est", pttc) 

print(taux(200, 230))
pour = taux(200, 170)*100
print('En passant de 200 à 170, le\n prix subit un évolution de', pour, "%") 

print(depart(-0.15, 170))
pht = depart(0.2, 139.99)
print("Avec une TVA à 20% un objet\n dont le PTTC est 139,99 a\nun PHT de", pht)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.