Asking about how to write the code
This is a PRACTICE question. Define the function sum2(...) which receives two integer numbers n1 and n2 as parameters and it returns the sum of those numbers.
As an example, the following code fragment:
res = sum2(2,5)
print (res)
should produce the output:
7
Voters
JoshDaBosh (79)
def sum2(n1, n2):
return int(n1)+int(n2)
TZLALA (0)
@JoshDaBosh Why it didn't works
n1 = int(input("Put a integer number"))
n2 = int(input("Put another integer number"))
def sum2(n1, n2):
return n1 + n2
JoshDaBosh (79)
@TZLALA you didn't call the function and didn't indent properly
JosephBarroso (1)
def sum2(a, b):
return a + b
TZLALA (0)
@JosephBarroso Why it didn't work
n1 = int(input("Put a integer number"))
n2 = int(input("Put another integer number"))
def sum2(n1, n2):
return n1 + n2
@timmy_i_chen I think this is somebody cheating their homework. They've got multiple of these questions which sound like homework.
@John_WardWard The user in question has been banned.