Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1)--------
- #num_list = [1, 2, 3, 1, 2]
- #
- # set_num_list = set(num_list)
- #
- # print(len(set_num_list))
- 2)--------
- #list_1 = {1, 3, 2}
- # list_2 = {4, 3, 2}
- #
- # print(len(list_1 & list_2))
- 3)--------
- # list_1 = {1, 3, 2}
- # list_2 = {4, 3, 2}
- #
- # print(list(list_1 & list_2))
- 4)--------
- list_1 = [1, 2, 3, 2, 3, 4]
- # set_list = set()
- #
- # for char in list_1:
- # if char in set_list:
- # print("Yes")
- # else:
- # print("No")
- # set_list.add(char)
- 5)--------
- print("Введите N и M")
- # N, M = map(int, input().split())
- #
- # colors_Anya = set()
- # colors_Borya = set()
- #
- # for i in range(N):
- # color = int(input("Введите цвет Ани"))
- # colors_Anya.add(color)
- #
- # for i in range(M):
- # color = int(input("Введите цвет Бори"))
- # colors_Borya.add(color)
- #
- # common_colors = colors_Anya & colors_Borya
- # only_colors_Anya = colors_Anya = common_colors
- # only_colors_Borya = colors_Borya = common_colors
- #
- # print(len(common_colors))
- # print(*sorted(common_colors))
- # print(len(only_colors_Anya))
- # print(*sorted(only_colors_Anya))
- # print(len(only_colors_Borya))
- # print(*sorted(only_colors_Borya))
- 6)--------
- #num_list = int(input("Напишите число строк: "))
- #
- # unique_words = set()
- #
- # for i in range(num_list):
- # list_1 = input("Напишите строку(и): ").split()
- # unique_words.update(list_1)
- #
- # print(len(unique_words))
- 7)--------
- #n = int(input("Август загадал натуральное число: "))
- # possible_numbers = set(range(1, n+1))
- #
- # while True:
- # question = input('Введите вопрос: ')
- # if question == "Help":
- # break
- # else:
- # numbers = set(map(int, question.split()))
- # answer = input("Напишите ответ(Yes, No): ")
- # if answer == "Yes":
- # possible_numbers &= numbers
- # else:
- # possible_numbers -= numbers
- # print("No")
- #
- # print(*possible_numbers)
- 8)--------
- #n = int(input('Август загадал натуральное число: '))
- # s = set(range(1, n + 1))
- # answer = []
- #
- # while True:
- # request = input('Введите вопрос: ')
- #
- # if request == 'Help':
- # break
- #
- # request = set([int(i) for i in request.split()])
- #
- # if len(request) > len(s) / 2:
- # s &= request
- # answer.append('Yes')
- # else:
- # s -= request
- # answer.append('No')
- #
- # for i in answer:
- # print(i)
- #
- # print('Август задумал числа: ', *sorted(list(s)))
- 9)--------
- 10)-------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement