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

 

david.white@denison.edu cs111fall2019 > distance
prev  |  next  |  chance

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