def solution(nums:list) -> list :
"""your code"""
result = []
start_alphabet = ['j', 'z', 'd', 'f', 'h']
for i in nums:
for n in start_alphabet:
if i.startswith(n):
result.append(i)
break
return result
def solution(nums: list) -> list:
"""your code"""
# l = ['j', 'z', 'd', 'f', 'h']
# for i in nums:
# if i[0] not in l:
# l.remove(i)
nums = [i for i in nums if i[0] in ['j', 'z', 'd', 'f', 'h']]
return nums
assert solution(['jiu', 'zhangyu', 'luosifen']) == ['jiu', 'zhangyu']
assert solution(['laobie', 'tudou', 'liyu', 'huangyu']) == ['huangyu']
def solution(nums:list) -> list :
total_list=['j','z','d','f','h']
return [nums[i] for i in range(len(nums)) if nums[i][0] in total_list]
assert solution(['jiu', 'zhangyu', 'luosifen']) == ['jiu', 'zhangyu']
assert solution(['laobie', 'tudou', 'liyu', 'huangyu']) == ['huangyu']