Answer:
def func(list):
iterator1 = 0
iterator2 = 0
iterator3 = 0
largest_str = "..."
Largest_str = "..."
for i in list:
if (len(i) >= 4 and i.find('Help') == 0):
iterator1 += 1
if (len(i) >= 2 and i.find('lp') != -1):
iterator2 += 1
if (len(i) > iterator3):
iterator3 = len(i)
largest_str = i
if (len(i) >= 10 and i.find('io') != -1):
Largest_str = i
length = 10e5
a = ""
for i in list:
if (len(i) < length):
length = len(i)
a = i
list.remove(a)
length = 10e5
b = ""
for i in list:
if (len(i) < length):
length = len(i)
b = i
list.remove(b)
length = 10e5
c = ""
for i in list:
if (len(i) < length):
length = len(i)
c = i
list.remove(c)
print("Number of words, which are begin with \"Help\": " + str(iterator1))
print("Number of words, which are contain \"lp\": " + str(iterator2))
print("Largest string in the list: \"" + largest_str +'\"')
print("Three smallest elements of the list: \"" + a + '\", \"' + b + '\", \"' + c + '\"')
print("The string(length <= 10), which contain \"io\": \"" + Largest_str + "\"")
Comments
Leave a comment