# Oleg Ch from collections import defaultdict create list of commands to

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39``` ```Oleg Ch from collections import defaultdict ​ # 1 create a list of commands to delete this mac mac_ids = ['aaabbcc', 'a1b1c1'] command = [f'curl -X DELETE https://marina.ring.com/{mac}' for mac in mac_ids] print(command) ​ # 2 for each letter return the position of last occurrence abracadabra = 'abracadabra' another_result = {k:v for v,k in enumerate(abracadabra)} print(another_result) ​ # 2* create a dict with count of each element (have a look at defaultdict) list_of_integers = [1, 2, 4, 6, 2, 7, 1, 2, 1, 2, 2] result = defaultdict(int) ​ for integer in list_of_integers: result[integer] += 1 ​ print(f'{list_of_integers} - > {dict(result)}') ​ # 3 return count of even elements elements = [1, 2, 3, 4, 5, 6, 6, 6, 7, 8, 22] result = len([x for x in elements if x % 2 == 0]) print(f'{elements} - > {result}') ​ # 4 return only those elements that can be divided by position index (add 0s) integers = [0, 3, 3, 6, 12, 7, 4, 21] result = [y for x, y in enumerate(integers) if x == 0 or y % x == 0] ​ print(result) ​ # 5 Turn letters on even positions uppercase and on odd positions lowercase letters = 'quick BROWN fox JUMPS over THE lazy DOG' result_5 = [x.upper() if ind % 2 == 0 else x.lower() for ind, x in enumerate(letters)] result_5 = ''.join(result_5) print(result_5) ```