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
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
Please open Telegram to view this post
VIEW IN TELEGRAM
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
data = [5, 10, 15, 20]
data.extend([x // 2 for x in data[:2]])
print(sum(data))
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM