print ('Welcome to Straight Line Calculator') print ('############################') print ('Option 1 = Distance') print ('Option 2 = Midpoint') print ('Option 3 = Gradient') print ('Option 4 = Equation of Line') print ('############################') choice = input('Select an option (1 - 4)') if choice < 1: print ('Choice must be between 1 and 4, please try again') choice = input('Select an option (1 - 4)') else: choice > 4: choice = input('Select an option (1 - 4)') if choice = 1: 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') dist_sum = math.sqrt(pow(x2-x1, 2)+pow(y2-y1, 2) print dist_sum
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