Added missing files and removed unnessesary ones

This commit is contained in:
2023-07-16 16:44:42 +03:00
parent c3fa5367c3
commit 199dd693e4
41 changed files with 1442 additions and 50 deletions

View File

@ -0,0 +1,10 @@
a = [12, 34, 542, 12, 63653, 635, 635]
def foo(i):
print(i)
return i
seen = set()
print(not any(i in seen or seen.add(i) for i in a))

View File

@ -0,0 +1,11 @@
from random import randint
import numpy as np
SIZE = 10
a = [randint(0, 100_000) for _ in range(SIZE**2)]
a = np.array(a)
a = a.reshape((SIZE, SIZE))
print(a)
print(np.min(a), np.max(a))

View File

@ -0,0 +1,6 @@
a = [12, 34, 542, 63653, 635, 635, 20]
for id, i in enumerate(a):
if i == 20:
a[id] = 200
break

View File

@ -0,0 +1,16 @@
a = {
12: 30,
30: 40,
50: 60,
70: 80,
}
# Вар 1
for key, value in a.items():
print(a)
# Вар 2
for key in a:
print(key)
for value in a.values():
print(value)

View File

@ -0,0 +1,2 @@
a = {i: i**2 for i in range(1, 16)}
print(a)

View File

@ -0,0 +1,4 @@
with open("task5.txt") as f:
nums = map(int, f.read().split())
print(sum(nums))

View File

@ -0,0 +1 @@
10 20 30

View File

@ -0,0 +1,21 @@
from dataclasses import dataclass
from typing import Self
@dataclass
class Foo:
a: int
b: int
def print(self: Self) -> None:
print(self.a, self.b)
def max(self: Self) -> int:
return max(self.a, self.b)
def sum(self: Self) -> int:
return self.a + self.b
def change_vals(self: Self, a: int, b: int) -> None:
self.a = a
self.b = b

View File

@ -0,0 +1,3 @@
a = [10, 12, 34, 542, 63653, 635, 635]
b = [21, 5165, 623, 542, 10]
print(sorted(set(a).intersection(b)))

View File

@ -0,0 +1,4 @@
def sum_range(a: int, b: int, /) -> int:
if a > b:
a, b = b, a
return sum(range(a, b))

View File

@ -0,0 +1,4 @@
from collections import Counter
a = [12, 34, 542, 63653, 635, 635]
print(Counter(a))