Let's say I have a list with 0 or more elements, how can I return the amount of strings in it without using count() or other methods other than a while loop? I tried the code below but it keeps crashing.
values = ["one", "two", [], 6]
def count_str(values):
index = 0
while index <= len(values):
if type(values[index]) == str:
index += 1
return index