def f(x, y, z):
return x + y + z
d1 = {'x': 1, 'y': 2}
d2 = {'y': 3, 'z': 4}
try:
print(f(**d1, **d2))
except TypeError:
print("TypeError")
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
def calculate(x, y):
if x > y:
return x - y
else:
return y - x
result = calculate(10, 15) + calculate(20, 8)
print(result)
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
class Matrix:
def __init__(self, data):
self.data = data
def __add__(self, other):
return Matrix([[self.data[i][j] + other.data[i][j]
for j in range(len(self.data[0]))]
for i in range(len(self.data))])
def sum(self):
return sum(sum(row) for row in self.data)
m1 = Matrix([[1, 2], [3, 4]])
m2 = Matrix([[5, 6], [7, 8]])
result = m1 + m2
print(result.sum())
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
👍1🔥1
Media is too big
VIEW IN TELEGRAM
Ссылка на сервис → https://gurufy.ru
Please open Telegram to view this post
VIEW IN TELEGRAM
try:
1 / 1
except ZeroDivisionError:
print("A", end="")
else:
print("B", end="")
finally:
print("C", end="")
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
info = {'name': 'Python', 'version': 3}
info['year'] = 2024
total = len(info) + info['version']
print(total)#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Forwarded from Находки Программиста
Цена: ~15000₽
Рейтинг: 4.8
Отзывов: 1.431
Компьютерный стол с электрической регулировкой высоты позволит работать сидя или стоя одним нажатием кнопки. Просторная столешница 150×78 см легко вместит несколько мониторов, ноутбук и всю периферию. Отличный выбор для программистов и удаленщиков, которые проводят за компьютером весь день и хотят сделать рабочее место более комфортным и эргономичным.
#стол #регулировка
Находки Программиста
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
t = (1, 2, [3, 4])
d = {}
try:
d[t] = "success"
print(d[t])
except TypeError:
print("TypeError")
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM