1. The string length is 2 or more
2. The first and last characters are the same
2. The first and last characters are the same
\
-----------------------------------------
list_items = ["hi","hello","pip","pop","city","high"]
count = 0
for string in list_items:
if(len(string)>=2 and string[0] == string[-1]):
print(string)
count = count + 1
print(count)
-----------------------------------------
Output:
pip
pop
high
3
0 Comments