Tasks

A. Placing Marbles … Count “1” in the input string

print(input().count("1"))

B. Shift Only … Add the result into the temporary list if the number modulo 2 is 0. In each iteration of the list, compare the length of the original list and temporary list.

n = int(input())
a = list(map(int, input().split()))
result = 0
while True:
temp_a = []
for num in a:
if num%2 == 0:
temp_a.append(num//2)
if len(temp_a) != n:
break
a = temp_a
result += 1
print(result)

C. Not So Diverse … In python, there is a Counter function which can create a dictionary from a list. In this case, take a list of numbers, and make a dictionary which has “number” as a key, and “times of the number appears in the list” as a value.

n = int(input())
a = list(map(int, input().split()))
result = 0
while True:
temp_a = []
for num in a:
if num%2 == 0:
temp_a.append(num//2)
if len(temp_a) != n:
break
a = temp_a
result += 1
print(result)

*Related*