class MockObject:
def __new__(cls):
return 42
def __init__(self):
print("Init")
obj = MockObject()
print(obj)
#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
Please open Telegram to view this post
VIEW IN TELEGRAM
for i in range(2):
try:
print(i, end="")
continue
finally:
print("F", end="")
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
colors = ['red', 'green', 'blue']
colors.insert(1, colors.pop())
colors.reverse()
print(colors[0])
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
data = {}
data.setdefault("keys", []).append(1)
data.setdefault("keys", []).append(2)
print(data["keys"])#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM