x1 = input('Please enter a value for x1') x2 = input('Please enter a value for x2') y1 = input('Please enter a value for y1') y2 = input('Please enter a value for y2') print x1, x2, y1, y2 diff_xcords = x2 - x1 print ('Difference of X Co-Ordinates:') print diff_xcords diff_ycords = y2 - y1 print ('Difference of Y Co-Ordinates:') print diff_ycords dist_sum_calc1 = pow(diff_xcords, 2) print dist_sum_calc1 dist_sum_calc2 = pow(diff_ycords, 2) print dist_sum_calc2 dist_sum_calc3 = dist_sum_calc1 + dist_sum_calc2 print dist_sum_calc3 dist_sum_sqrt = dist_sum_calc3 ** 0.5 print dist_sum_sqrt # dist_sum = math.sqrt(pow((x2-x1), 2) + pow((y2-y1), 2)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question