StudyRepo_Synergy/part1_basic/lesson7/app.py

17 lines
539 B
Python
Raw Normal View History

2023-10-14 22:13:42 +03:00
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)))