关于#python#的问题:python如何不使用任何已有字符串方法和函数,也不用 in 运算符,判断一个字符串中是否包含子字符串 'ch'

python如何不使用任何已有字符串方法和函数,也不用 in 运算符,判断一个字符串中是否包含子字符串 'ch'

s = 'abcchhcba'
i = 1
while i < len(s):
    if s[i-1]=="c" and s[i]=="h":
        print(True)
        break
    i += 1
else:
    print(False)