mx_02.py

Created by cent20

Created on November 18, 2021

527 Bytes

Option maths expertes
Divisibilité dans les entiers relatifs


# MX02 - III - C - Q.3
def diveuc1(dividence, diviseur):
  """
  Division euclidienne de a par b
  Méthode des soustractions successives.
  """
  quotient = 0
  reste = dividence 
  while reste >= diviseur:
    reste = reste - diviseur 
    quotient += 1
  return quotient, reste
  
# MX02 - III - C - Q.6 - Base de travail
def diveuc2(a, b):
  """
  Cette version exploite les opérateurs python // et %
  Elle ne répond malheureusement pas à la consigne, le résultat est parfois faux
  """
  return a//b, a%b

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.