Please open Telegram to view this post
VIEW IN TELEGRAM
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
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