__author__ = 'Owner' # This program is going to solve the obtuse of a right angled triangle using pythagoras theorem import math # Store input numbers base = float(input('Enter base of triangle: ')) #I called my variable base height = float(input('Enter the height of triangle: ')) #I called my variable height #calulating my obtuse using Pythagoras theorem the square of obtuse equal of sum of of the square of # the base and the square of the height a2 = b2 + c2 square_obtuse = 0.0 #I set the variable square_obtuse to 0.0 there by creating a float (a number with decimals) obtuse = 0.0 #I set the variable obtuse to 0.0 there by creating a float (a number with decimals square_obtuse = (base * base)+ (height * height) #assinging sqaure_obtuse the value of pytagoras solution a2= b2+c2 obtuse = math.sqrt(square_obtuse) #finding the square root of square_obtuse by using the python function math.sqrt() # Display the answer print("The obtuse of a triangle of base ", base, "and height ", height, "is ", obtuse)
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