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
👍1
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
🔥1
Please open Telegram to view this post
VIEW IN TELEGRAM
def modify(x, y=[]):
y.append(x)
return sum(y)
result = modify(5) + modify(7) + modify(4)
print(result)
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
def modify(x, y=[]):
y.append(x)
return sum(y)
result = modify(5) + modify(7) + modify(4)
print(result)
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
from itertools import islice
def infinite_seq():
n = 1
while True:
yield n
n *= 2
gen = infinite_seq()
result = list(islice(gen, 5))
print(sum(result))
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
❤2
def modify(x, y=[]):
y.append(x)
return sum(y)
result = modify(5) + modify(7) + modify(4)
print(result)
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM