0

# Please help me fix this.

I want to make a function that show the sum of two numbers, but this doesn't work. def sumOf2(n1,n2): n1 = int(input()) n2 = int(input()) x = n1+n2 return x total = sumOf2

3 Answers

+ 2

https://code.sololearn.com/c8h4J7m110EH
n1 = int(input())
n2 = int(input())
def sumOf2(n1,n2):
x=n1+n2
return x
total = sumOf2(n1,n2)
print(total)

+ 4

Your function doesn't need parameters if you take input inside the function
Also you forgot the () when you call the function

+ 1

As Lisa explained, the correct code is below:
def sumOf2():
n1 = int(input())
n2 = int(input())
x = n1+n2
return x
total = sumOf2()
print(total)
And you might want to add print at the end to see your result :)