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

 

distance


Write a function distance(x1, y1, x2, y2) that returns the distance between points (x1; y1) and (x2; y2). If you do not remember the formula for the distance between two Cartesian points, you may google it. You may assume that the function you are writing is part of a larger program where the math module has already been imported.


distance(0, 0, 1, 0) → 1.0
distance(0, 3, 4, 0) → 5.0
distance(13, 1, 1, -4) → 13.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

Copyright Nick Parlante 2017 - privacy