+ 1
Hypotenuse finder in python (help)
Iām new to coding so I figured Iād start on python. Iāve tried using what Iāve learned about functions to write a program that will find the hypotenuse of any triangle. All you have to do is give it the side lengths and it will tell you the hypotenuse of that triangle. If someone could look at it and tell me where I went wrong I would be very appreciative
2 Answers
+ 3
"""
You made a lot of mistake in your short code...
Fixed and worked code would be:
"""
import math
def C_squared(a,b):
return math.sqrt(a**2+b**2)
i1 = int(input())
i2 = int(input())
C=C_squared(i1,i2)
print("hypotnuse is "+str(C))
# Anyway, feel free to ask much more help on specific topic (that's too long to explicit each of your mistake ^^)
0
Thanks so much! I guess Iāve still got some learning to do
Iām curious what a simple thought process would be for writing calculator codes.
Is it simply 1. Define function 2. Create variables 3. Return input to function 4.Print answer?