Q:

Python while loop , how can I reach a given list?

items = ['apple', 55, 1.2, 'banana', lambda a: a, 
     'pear', None, 'cherry', """Hello world!""",
     '''The Who''', ("a", 5), [("a", "5"), ("b", 3)]]

i = ""

while i in items:
if(items == type(str)):
    print("There are 6 string")
if(items != type(str)):
    print("There ara no string value")

I've written this program but it's not working.
How can I reach the list and print how much string in this list also with type() method?
After;
since there are multiple string values in the input list. However, in case there are no string values, your program should output
There are no string values
In case there is only one string value, then it should print out
There is a single string value.
İt's my homework but I'm stuck at this question.
Also, can I do with for loop?

A:

I believe that what you want to do is this:
items = ['apple', 55, 1.2, 'banana', lambda a: a, 'pear', None, 'cherry',  """Hello world!""", '''The Who''', ("a", 5), [("a", "5"), ("b", 3)]]

i = 0

for item in items:
   if(type(item) == str):
       i += 1

print(f'There are {i} string' if i > 0 else "There are no string values")

