单选题

运行下方代码段,输出的结果是( )。

def isPrefixOfWord(sentence,searchWord):

         l = sentence.split()

         for i in range(len(l)):

                 if l[i][:len(searchWord)]==searchWord:

                         return i + 1

         return -1

sentence = "Python is the best computer language!"

searchWord = "comput"

i = isPrefixOfWord(sentence, searchWord)

print(i)

A

-1

B

i+1

C

5

D

6

赣ICP备20007335号-2