JustPaste
HomeCategoriesAboutDonateContactTerms of UsePrivacy Policy
JustPaste

Free online notepad — write and share instantly

Navigate

  • Home
  • Timeline
  • Categories

Info

  • About
  • Donate
  • Contact

Legal

  • Terms of Use
  • Privacy Policy

© 2026 JustPaste.app. All rights reserved.

Made with ♥ by JustPaste

Untitled Page | JustPaste.app
3 months ago38 views
👨‍💻Programming
# --- 1. INTERFACE PYQT5 ---
# ch = win.nom.text()          -> Récupérer texte
# win.le.setText(ch)           -> Afficher texte
# win.le.clear()               -> Effacer champ

# --- 2. ARITHMÉTIQUE CLASSIQUE ---
def factorielle(n):
    f = 1
    for i in range(1, n + 1):
        f = f * i
    return f
def puissance(a, b):
    p = 1
    for i in range(b):
        p = p * a
    return p
def premier(n):
    if n < 2: return False
    i = 2
    while i <= n // 2 and n % i != 0:
        i = i + 1
    return i > n // 2
def facteur_premier(x):
    i = 2
    ch = ""
    while x > 1:
        if x % i == 0:
            ch = ch + str(i) + "*"
            x = x // i
        else:
            i = i + 1
    return ch[:-1] # Enlève le dernier "*"
# --- 3. PGCD & PPCM ---
def pgcd_soustraction(x, y):
    while x != y:
        if x > y:
            x = x - y
        else:
            y = y - x
    return x
def pgcd_euclide(x, y):
    while y != 0:
        r = x % y
        x = y
        y = r
    return x
def ppcm(x, y):
    r = x
    while r % y != 0:
        r = r + x
    return r
# --- 4. MATRICES & CHAÎNES ---
def distinct(ch_col, d1):
    # La méthode de ton prof
    if d1.find("|" + ch_col + "|") == -1:
        d1 = d1 + ch_col + "|"
        return True, d1
    return False, d1
def inverser_chaine(ch):
    res = ""
    for i in range(len(ch) - 1, -1, -1):
        res = res + ch[i]
    return res
# --- 5. ENREGISTREMENTS (DICT) ---
# T[i] = {"Som": s, "Num": i, "Prime": premier(s)}

⚠️Content was pasted as plain text and auto-formatted as a code block. Use the Code Block button in the editor for proper formatting.

← Back to timeline