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

 

slope


Two points in a plane a specified using the coordinates (x1,y1) and (x2,y2). Calculate the slope of a line through two (non-vertical) points.


slope(18, 17, 24, 24) → 1.1666666666666667
slope(-1, 0, 25, 7) → 0.2692307692307692
slope(1, 1, 0, 1) → -0.0

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

def slope(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: 101 Post-solution available

Copyright Nick Parlante 2017 - privacy