There is list of integers return count of even elements 22 count for i

 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
3. There is a list of integers, return count of even elements:
d = [1, 2, 3, 4, 5, 6, 6, 6,7, 8, 22]
count = 0
for e in d:
if e % 2 == 0:
count += 1
print(count)
#Note: I got issues converting the output(int) into the list to count it as I used to, need some explenations
4. There is a list of integers, return only those elements that can be divided by position index (add 0s)
a = [0, 3, 3, 6, 12, 7, 4, 21]
for (i,e) in enumerate(a):
if i == 0 or i != 0 and e % i == 0:
print(e)
5. Turn letters on even positions uppercase and on odd positions lowercase
a = "quick BROWN fox JUMPS over THE lazy DOG"
result = []
for i,e in enumerate(a):
if i % 2 == 0:
result.append(e.upper())
else:
result.append(e.lower())
print(''.join(result))