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 increment(x):
x += 10
return x
value = 5
new_value = increment(value)
print(value + new_value)
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Варианты ответа:
Anonymous Quiz
27%
{'a': 1, 'b': 2, 'c': 4}
59%
{'a': 1, 'b': 3, 'c': 4}
15%
TypeError
d = {'a': 1, 'b': 2, 'c': 3}
try:
for k in d:
del d[k]
print(len(d))
except RuntimeError:
print("RuntimeError")#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
def add_item(val, target=[]):
target.append(val)
return target
print(add_item(1), add_item(2))
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
def modify(n):
n = n + 5
n *= 2
return n
x = 10
result = modify(x) + x
print(result)
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM