• Python question of the day

    What would be the output of executing the following code:
    s = 'apple'
    print(s.find('p') + s.rfind('f') + s.find(''))
     0
     False
     True
     IndexError
    Explanation:
    find method returns the lowest index in the string where substring is found. Returns -1 if substring is not found. Returns 0 if substring is null


    Top 100 python interview questions:






datai analytics