1 changed files with 18 additions and 5 deletions
@ -1,16 +1,29 @@ |
|||
from math import * |
|||
|
|||
def points (x,y): |
|||
"""fonction points prenant en paramètres deux entiers x et y (les coordonnées du point où a eu lieu l’action) |
|||
et qui renvoie l’entier 2 si le point est à l’intérieur d’un des demi-cercles et 3 sinon""" |
|||
|
|||
milieu_de_terrain = 300 |
|||
cote_a = x |
|||
|
|||
cote_a = x |
|||
cote_b = milieu_de_terrain - y |
|||
|
|||
r = (cote_a)**2 + (cote_b)**2 |
|||
r = sqrt(r) |
|||
rd = (cote_a)**2 + (cote_b)**2 |
|||
rd = sqrt(rd) |
|||
|
|||
cote_a = 1000 - x |
|||
|
|||
rg = (cote_a)**2 + (cote_b)**2 |
|||
rg = sqrt(rg) |
|||
|
|||
if r > 250: |
|||
if rd > 250 and rg >250: |
|||
return 3 |
|||
else: |
|||
return 2 |
|||
|
|||
print(points (100,400)) |
|||
"""tests pour la fonction""" |
|||
print(points (150,300)) |
|||
print(points (500,300)) |
|||
print(points (900,100)) |
|||
print(points (750,400)) |
Loading…
Reference in new issue