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

 

gaurav1780@gmail.com 01_variables_and_operators > perimeter
prev  |  next  |  chance

Define a function that when passed two integers representing the x and y intercepts of a line, returns the perimeter of the triangle formed by those two points and the origin (0, 0). You can use math.sqrt() to find the square root of a number, and abs() to find the absolute value of a number. The complexity of this question is in the research and analysis, not the implementation.


perimeter(3, 4) → 12.0
perimeter(8, -6) → 24.0
perimeter(-10, 10) → 34.14213562373095

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

def perimeter(x, y):

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: 1 Post-solution available

Copyright Nick Parlante 2017 - privacy