17 lines
539 B
Python
17 lines
539 B
Python
|
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)))
|