id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

konstans@stuy.edu all > distance
prev  |  next  |  chance

Calculate and return the Euclidean distance between the coordinates given as parameters. (Distance Formula) To calculate a square root use: math.sqrt(a) OR a**0.5 WARNING: Codingbat automatically imports math, normally you must import it yourself.


distance(3, 0, 0, 4) → 5.0
distance(1, 0, 2, 0) → 1.0
distance(0, 0, 8, 15) → 17.0

...Save, Compile, Run (ctrl-enter)

def distance(x1,y1,x2,y2):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 2

Copyright Nick Parlante 2017 - privacy