id/email
password
forgot password | create account
about | help | prefs
ReadingBatcode reading practice

 

 

Warmup 1count1

prev  |  next  |  chance
def count1(x):
    count = 0
    for i in range(len(x)):
        if x[i:i + 2] == 'ba':
            count += 1
    return count
Function Call  Return Value
count1('baba')
count1('aba')
count1('baaabab')
count1('abc')
count1('goodbye')
count1('a')
count1('ba')

Experiment with this code on Gitpod.io

⬅ Back