链接: https://pan.baidu.com/s/1pfgFGBTxXtt-iLiVD_awxg 密码: nqa6
# -1 myStrCount to count times of char in str
# 0 string myIndex function
# 1 string myfind fun
# 2 findlistMax fun, find max value
# 3
def myStrCound(li, c):
count = 0
for x in li:
if x == c:
count += 1
return count
s = "hello jeapedu.com"
t = myStrCound(s, "e")
print(s, "e", t)
print("--------------------------")
def myIndex(li, t):
i = 0
while i < len(li):
if li[i] == t:
return i
break
i += 1
li = [3, 4, 2, 5, 5, 2, 3]
t = myIndex(li, 5)
print(li, 5, t)
print("--------------------------")
def myfind(s, t):
i = 0
while i < len(s):
if s[i] == t:
return i
break
i += 1
s = "hello jeapedu.com"
t = myfind(s, "u")
print(s, "u", t)
print("--------------------------")
def findlistMax(li):
max = li[0]
for x in li:
if max < x:
max = x
return max
li = [234, 23, 4, 2344, 999]
max = findlistMax(li)
print(li, max)
print("--------------------------")