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.

5 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. Please 🙏 explain third

    ReplyDelete
    Replies
    1. because there is colon which is wrong.

      Delete
    2. def alpha(n, string='xyz', k=10):
      result = 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"))

      Delete
  2. Please 🙏 explain third

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post