"""
Create a list called my_example_list and
assign arbitrary elements to it. For example:
"""
l = [True, "ICC", -99.5, 0]
print(l)
print(l[:])
print(l[2:4])
print(l[1::2])
print(l[-1])
print(l[::-1])
print(l[1::-1])

"""
Write a piece of code that traverses one list, counts all strings in and prints out the count
Example: my_list = [5, 'song', 'cello', 60.4, 'theater',  'scene', -6.20, True]
Expected result: 4
"""
my_list = [5, 'song', 'cello', 60.4, 
           'theater',  'scene', -6.20, True]

n_strings = 0
for i in my_list:
    if type(i) is str:
        n_strings +=1
        print(i)
print(n_strings)

"""
Example: Write a piece of code that traverses one list and returns another list, which contains every element at an even index of the original list.
Example: my_list = [43, -32, -94, -10, -18, 33, -59]
Expected result: res_list = [43, -94, -18, -59]
"""

in_list = [43, -32, -94, -10, -18, 33, -59]
out_list = []  # Create an empty list to fill in

# Iteration over list elements
for i in range(len(in_list)):
    # Consider only elements at even indices
    if i % 2 == 0:
        out_list.append(in_list[i])
print(out_list)


