StudyRepo_Synergy/part1_basic/lesson7/app.py

28 lines
861 B
Python
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

"""
Модуль является результатом выполнения практической
домашней работы по теме "Структуры данных"
:copyright: Сергей Ванюшкин <pi3c@yandex.ru>
:git: https://git.pi3c.ru/pi3c/StudyRepo_Synergy.git
:license: MIT
2023г.
"""
from random import randint as r
some_tuple = tuple(r(1, 10) for _ in range(3))
print("Кортеж:", some_tuple)
for i in range(len(some_tuple)):
print(f"{i + 1}ый элемент:", some_tuple[i])
print("Сумма: ", sum(some_tuple))
print()
first_list = list(r(1, 10) for _ in range(5))
second_list = list(r(1, 10) for _ in range(5))
print("Сгенерированные списки:")
print(first_list, second_list, sep="\n")
print("Количество пересечений: ", len(set(first_list) & set(second_list)))