Added missing files and removed unnessesary ones
This commit is contained in:
10
Python/pyton_test/task1.py
Normal file
10
Python/pyton_test/task1.py
Normal 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))
|
11
Python/pyton_test/task10.py
Normal file
11
Python/pyton_test/task10.py
Normal 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))
|
6
Python/pyton_test/task2.py
Normal file
6
Python/pyton_test/task2.py
Normal 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
|
16
Python/pyton_test/task3.py
Normal file
16
Python/pyton_test/task3.py
Normal 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)
|
2
Python/pyton_test/task4.py
Normal file
2
Python/pyton_test/task4.py
Normal file
@ -0,0 +1,2 @@
|
||||
a = {i: i**2 for i in range(1, 16)}
|
||||
print(a)
|
4
Python/pyton_test/task5.py
Normal file
4
Python/pyton_test/task5.py
Normal file
@ -0,0 +1,4 @@
|
||||
with open("task5.txt") as f:
|
||||
nums = map(int, f.read().split())
|
||||
|
||||
print(sum(nums))
|
1
Python/pyton_test/task5.txt
Normal file
1
Python/pyton_test/task5.txt
Normal file
@ -0,0 +1 @@
|
||||
10 20 30
|
21
Python/pyton_test/task6.py
Normal file
21
Python/pyton_test/task6.py
Normal 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
|
3
Python/pyton_test/task7.py
Normal file
3
Python/pyton_test/task7.py
Normal 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)))
|
4
Python/pyton_test/task8.py
Normal file
4
Python/pyton_test/task8.py
Normal 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))
|
4
Python/pyton_test/task9.py
Normal file
4
Python/pyton_test/task9.py
Normal file
@ -0,0 +1,4 @@
|
||||
from collections import Counter
|
||||
|
||||
a = [12, 34, 542, 63653, 635, 635]
|
||||
print(Counter(a))
|
Reference in New Issue
Block a user