|
@@ -0,0 +1,50 @@
|
|
|
+
|
|
|
+def words_length(data: list):
|
|
|
+ return [len(x) for x in data]
|
|
|
+
|
|
|
+
|
|
|
+def filter_long_words(data: list, n: int):
|
|
|
+ return [x for x in data if len(x) > n]
|
|
|
+
|
|
|
+
|
|
|
+def is_member(value, lst: list):
|
|
|
+ return value in lst
|
|
|
+
|
|
|
+
|
|
|
+# Пересечение множеств
|
|
|
+def overlapping(l1: list, l2: list):
|
|
|
+ return bool(set(l1).intersection(l2))
|
|
|
+
|
|
|
+
|
|
|
+def find_longest_word_len(lst: list):
|
|
|
+ return max([len(x) for x in lst])
|
|
|
+
|
|
|
+
|
|
|
+def register_check(dct: dict):
|
|
|
+ return len([x for x in dct.values() if x == 'yes'])
|
|
|
+
|
|
|
+
|
|
|
+# Объединение списков в список кортежей
|
|
|
+def create_tuples(l1: list, l2: list):
|
|
|
+ return list(zip(l1, l2))
|
|
|
+
|
|
|
+
|
|
|
+def make_header(text: str, level: int):
|
|
|
+ return f'<h{level}>{text}</h{level}>'
|
|
|
+
|
|
|
+
|
|
|
+def main():
|
|
|
+ # print(words_length(['Python', 'is', 'awesome!']))
|
|
|
+ # print(filter_long_words(['Python', 'stole', 'my', 'heart'], 4))
|
|
|
+ # print(overlapping(['this', 'might', 'work'], ['or', 'maybe', 'this']))
|
|
|
+ # print(find_longest_word_len(['default', 'ghostwriter', 'bother', 'applaud', 'skate', 'way']))
|
|
|
+
|
|
|
+ # people = {'Igor': 'yes', 'Stas': 'no', 'Peter': 'no', 'Mary': 'yes'}
|
|
|
+ # print(register_check(people))
|
|
|
+
|
|
|
+ # print(create_tuples([1, 2, 3, 4], [5, 6, 7, 8]))
|
|
|
+
|
|
|
+ print(make_header('Нет', 1))
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+ main()
|