Help me in solving PYTH99A problem

My issue

Solve the problem

My code

# Count how many 'o's are present in the string using a 'for' loop and 'if' condition

string = 'bolloon'
count = 0      
for c in range(len(string)):
 if(c=='o'):
     count=count+1
     print(count)
     
# use this variable to count occurrences of o

Learning course: Python with Data structures
Problem Link: Practice Problem in - CodeChef

string = ‘bolloon’
count = 0
for c in string:
if(c==‘o’):
count=count+1
print(count)
This code will work out
if you want to use len(string) then this is the change you should do
string = ‘bolloon’
count = 0
for c in range(len(string)):
if(string[c]==‘o’):
count=count+1
print(count)
here c gives index to use value at that index you should use string[index]