This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
odd = [ | |
0, | |
1, | |
3, | |
5, | |
7, | |
9, | |
] | |
even = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
from typing import Generic | |
from typing import TypeVar | |
from typing_extensions import reveal_type | |
V = TypeVar('V', covariant=True) | |
E = TypeVar('E', covariant=True) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pprint import pprint | |
from random import randint | |
class Room: | |
def __init__(self, a, b): | |
self.a = a | |
self.b = b | |
def s(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from abc import ABC, abstractmethod | |
class A(ABC): | |
@property | |
@abstractmethod | |
def attr(self) -> str: | |
... | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import statistics | |
import string | |
import time | |
import uuid | |
VARIANTS = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048] | |
ks = [] | |
ds = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
my_set = set(range(100)) | |
my_list = list(range(100)) | |
N = 10 | |
ATTEMPTS = 5 | |
print('\nVariant 1: using generator') | |
for _ in range(ATTEMPTS): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import UserString | |
from typing import Union | |
class StrIns(UserString): | |
def __setitem__(self, key: Union[int, slice], value: str) -> None: | |
if isinstance(key, int): | |
self._assign_one_element(key, value) | |
elif isinstance(key, slice): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
from typing import List | |
from typing import MutableSequence | |
from typing import Optional | |
from typing import TypeVar | |
T = TypeVar('T') | |
Sparse = MutableSequence[Optional[T]] | |
MIN = 0.0 |
NewerOlder