Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import copy
- # task 2
- L = [int(input()) for _ in range(5)]
- C = L[:]
- C = copy.copy(L)
- C = copy.deepcopy(L)
- C = list(L)
- # task 4
- from sys import getrefcount
- def to_dict(array,name):
- d = dict()
- d[name] = array
- return d
- N = int(input()) # кол-во животных
- animals = [input() for _ in range(N)]
- arr = to_dict(animals,'animals')
- summa = 0
- for x in arr['animals']:
- summa += getrefcount(x)
- print(summa, getrefcount(1) + getrefcount(2) + getrefcount(3))
- #task 5
- k = c = 0 # k - Одна ссылка, с - равные
- N = int(input())
- backpack = [input() for i in range(N)]
- for i in range(len(backpack)):
- for j in range(i + 1, len(backpack)):
- if backpack[i] is backpack[j]:
- k += 1
- if backpack[i] == backpack[j]:
- c += 1
- print(k,c)
- # task 6
- N = int(input()) # кол-во ингридиентов
- salad = [input() for _ in range(N)]
- salad += [salad]
- salad[6] += ['salt','pepper']
- print(salad[4], salad[-1])
Advertisement
Add Comment
Please, Sign In to add comment