prodscal2.py

Created by frederic-junier

Created on July 10, 2019

339 Bytes

Dans le plan muni d’un repère orthonormé on considère les pointsO(0,0) etA(100,0). La liste L contient en sortie de boucle les coordonnées (x,y) de tous les points B distincts de O et A tels que OBA rectangle en B avec x et y entiers compris entre 0 et 100.


def prodscal(x1, y1, x2, y2):
    """Retourne le produit scalaire de vecteurs de coordonnées
    (x1,y1) et (x2, y2)"""
    return x1 * x2 + y1 * y2

L = []
for x in range(0, 101):
    for y in range(0, 101):
        if (x,y) != (0,0) and (x, y) != (100,0) and prodscal(x, y, 100 -x, -y) == 0:
            L.append((x,y))

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.