Computer Science

Find the errors in code given below :

def minus(total, decrement)  
    output = total - decrement                              
    print(output)
    return (output)

Python Functions

6 Likes

Answer

The errors in the code are:

def minus(total, decrement) # Error 1  
    output = total - decrement                              
    print(output)
    return (output)
  1. There should be a colon at the end of the function definition line.

The corrected code is given below:

def minus(total, decrement): 
    output = total - decrement
    print(output)
    return (output)

Answered By

3 Likes


Related Questions