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

 

 

For Loopsfor_loop5

prev  |  next  |  chance

str[y:] returns a substring starting at index y

def for_loop5(str, x, y):
    result = 0
    for i in str[y:]:
        if i == x:
            result += 1
    return result
Function Call  Return Value
for_loop5('athenian', 'e', 2)
for_loop5('apples', 'p', 1)
for_loop5('hello', 'a', 3)
for_loop5('aa', 'a', 1)

Experiment with this code on Gitpod.io

⬅ Back