Q. Find the errors in the code given below:
(a)
def minus (total, decrement)
output = total - decrement
print(output)
return (output)
(b)
define check()
N = input ("Enter N: ")
i = 3
answer = 1 + i ** 4 / N
Return answer
(c)
def alpha (n, string ='xyz', k = 10) :
return beta(string)
return n
def beta (string)
return string == str(n)
print(alpha("Valentine's Day") :)
print(beta (string = 'true' ))
print(alpha(n = 5, "Good-bye") :)
Answer =
(a)
def minus (total, decrement):
output = total - decrement
print(output)
return (output)
(b)
def check():
N = input ("Enter N: ")
i = 3
answer = 1 + i ** 4 / N
return answer
(c)
Calling of function is in wrong way. If that is corrected then it will show no error.
Please 🙏 explain third
ReplyDeletebecause there is colon which is wrong.
Deletedef alpha(n, string='xyz', k=10):
Deleteresult = beta(string, n) # Pass n to beta for comparison
return result # Only one return statement needed
def beta(string, n): # Added n as an argument
return string == str(n)
print(alpha("Valentine's Day")) # No colon needed after function call
print(beta(string='true', n=5)) # Pass both arguments explicitly
print(alpha(n=5, string="Good-bye"))
Please 🙏 explain third
ReplyDeleteSimple ..
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )