Search code examples
pythonpython-3.x

how to add two numbers with this python code


//Function prototype:

int solveMeFirst(int a, int b);

where,

a is the first integer input. b is the second integer input Return values

sum of the above two integers//

def solveMeFirst(a,b):

   return a+b

 num1 = int(input(2))
 num2 = int(input(3))
 res = solveMeFirst(num1,num2)
 print(res)

Solution

  • Problem in input(). Which takes user input.

    def solveMeFirst(a,b):
    
       return a+b
    
    num1 = int(input("Enter first number: "))
    num2 = int(input("Enter second number: "))
    res = solveMeFirst(num1,num2)
    print(res)