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
class A:
def __new__(cls):
return 42
def __init__(self):
print("Init")
print(A())
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
class A:
def __init__(self):
self.__x = 1
def get_x(self):
return self.__x
class B(A):
def __init__(self):
super().__init__()
self.__x = 2
b = B()
print(b.get_x())
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
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
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 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