- 4
Addtion of two numbers using function.in python
6 ответов
+ 8
It is strongly recommended NOT to use function names of build-in functions <e.g. sum()> as names for user defined functions. This can lead to an unexpected behavior. Use sum_() instead.
+ 2
#Anonymous or inline function:
print((lambda x,y: x+y)(2,3))
#Output: 5
#function:
def add(x,y):
return x+y
print(add(2,3))
#Output: 5
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2437/?ref=app
+ 1
print(sum([2,3]))
0
int.__add__(9, 2) ---> 11
sum(7, 3) ---> 10
0
def sum(x,y):
return x+y
print(sum(x,y))