Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 1)Ответ: [54,84,10,58,54,84,10,58]
- # 2)
- '''
- import copy
- a = []
- for i in range(5):
- a.append(int(input()))
- b = a[:]
- c = a.copy()
- d = copy.copy(a)
- e = copy.deepcopy(a)
- f = list(a)
- print(5,sum(a))
- #Ответ: 5 35
- #3) Ответ: 966
- #4)
- import sys
- s = 0
- def list_in_dict(animal):
- a = {}
- for i in range(len(animal)):
- a[animal[i]] = n=animal.count(animal[i])
- return a
- animal = ["cat", "cat", "dog", "dog", "bird",
- "capybara", "capybara", "capybara"]
- print(list_in_dict(animal))
- b = (sys.getrefcount('cat'))
- c = (sys.getrefcount('dog'))
- d = (sys.getrefcount('bird'))
- f = (sys.getrefcount('capybara'))
- k = (sys.getrefcount('1'))
- l = (sys.getrefcount('2'))
- i = (sys.getrefcount('3'))
- print(b + c + d + f, k + l + i)
- #Ответ: 28 3000000024
- #5)
- backpack = ["capybara", "capyraba", "capyba", "capyba", "capybara",
- 2999, 2999, "capybara", [7, 7, 7], [7, 7, 7], [7, 7, 7],
- [7, 7, 7]] + [[8, 8]] * 5
- counter = 0
- anti_counter = 0
- for i in range(len(backpack)):
- for j in range(i + 1,len(backpack)):
- if backpack[i] is backpack[j]:
- counter += 1
- if backpack[i] == backpack[j]:
- anti_counter += 1
- print(counter,anti_counter)
- #Ответ: 15 21
- # 6)
- salat_cezar = ['lettuce', 'chicken', 'cheese', 'sauce', 'tomatoes', 'croutons']
- salat_cezar.append(salat_cezar)
- salat_cezar[6].append('salt')
- salat_cezar[6].append('pepper')
- print(salat_cezar[4], salat_cezar[-1])
- # Ответ: tomatoes pepper
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement