MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / getDistance

Function getDistance

src/gamesbyexample/lostkitty.py:65–68  ·  view source on GitHub ↗

Returns the distance between (x1, y1) and (x2, y2) by using the Pythagorean Theorem.

(x1, y1, x2, y2)

Source from the content-addressed store, hash-verified

63
64
65def getDistance(x1, y1, x2, y2):
66 """Returns the distance between (x1, y1) and (x2, y2) by using the
67 Pythagorean Theorem."""
68 return math.sqrt(((x1 - x2) ** 2) + ((y1 - y2) ** 2))
69
70
71def displayClue(playerx, playery, catx, caty):

Callers 2

mainFunction · 0.70
displayClueFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected