Please Correct error of this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3
17th Jul 2020, 12:43 PM
pratham jain
pratham jain - avatar
2 Answers
+ 2
Can You tell me what was my mistake Granger Thank you Soooooooo Much bro
17th Jul 2020, 1:00 PM
pratham jain
pratham jain - avatar
0
The indentation was not proper check from here:- #code to determine elements of pythaghoras theorem def hypotenus(p,b): return p**2+b**2 def perpendicular(a,c): return a**2-c**2 def base(x,z): return x**2-z**2 x=float(input(' type 1 to find hypotenus \n type 2 to find perpendicular \n type 3 to find base ')) if x==1: p=float(input('\n Enter perpendicular')) b=float(input('\n enter base')) print('\n hypotenus is',hypotenus(p,b)) elif x==2: a=float(input('\n Enter hypotenus')) c=float(input('\n enter base')) print('\n perpendicular is',perpendicular (a,c)) elif x==3: x=float(input('\n Enter hypotenus')) z=float(input('\n Enter perpendicular')) print('\n base is',base (x,z)) else: print ("bye") P.S. The result isn't the hypotenuse, base or perpendicular but it's square, you may change the code accordingly. Thank you.
17th Jul 2020, 1:46 PM
Anand Gupta
Anand Gupta - avatar