So I need to solve this Python code and fill in for the question marks. I\'m com
ID: 3744415 • Letter: S
Question
So I need to solve this Python code and fill in for the question marks.
I'm completely new to python and clueless of the method the teacher is using.
Any help is much appreciated!
import math
#function; pythagoras
? pythagoras(a1, b1)?
#calculate hypotenuse for rectangular triangle and print
??
??
#here is function; middlefunction
? middlefunction(a, b, func) ?
#put ‘a’ og ‘b’ to second degree
??
??
#call ‘func’ function with ‘a’ og ‘b’ in second degree
??
#this is the main function; __main__
x= 4
y= 3
name= pythagoras
#call middlefunction
middlefunctionl(x, y, name)
Explanation / Answer
import math # function; pythagoras def pythagoras(a1, b1): # calculate hypotenuse for rectangular triangle and print hypotenuse = (a1+b1) ** 0.5 print(hypotenuse) # here is function; middlefunction def middlefunction(a, b, func): # put ‘a’ og ‘b’ to second degree a = a ** 2 b = b ** 2 # call ‘func’ function with ‘a’ og ‘b’ in second degree func(a, b) # this is the main function; __main__ x = 4 y = 3 name = pythagoras # call middlefunction middlefunction(x, y, name)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.