def add_item(num, lst=[]):
lst.append(num)
return lst
add_item(1)
print(add_item(2))
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
def f(x, y, z):
return x + y + z
d1 = {'x': 1, 'y': 2}
d2 = {'y': 3, 'z': 4}
try:
print(f(**d1, **d2))
except TypeError:
print("TypeError")
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
def f(x, y, z):
return x + y + z
d1 = {'x': 1, 'y': 2}
d2 = {'y': 3, 'z': 4}
try:
print(f(**d1, **d2))
except TypeError:
print("TypeError")
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
def calculate(x, y):
if x > y:
return x - y
else:
return y - x
result = calculate(10, 15) + calculate(20, 8)
print(result)
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM