Print the elements whose array length is greater than or equal to 4, such as
things = ['jump','hop','skip','tip',leap']
Print the elements whose array length is greater than or equal to 4, such as
things = ['jump','hop','skip','tip',leap']
I would advice you to come up with the answer for this yourself. Some hints are :
fruits = ["apple", "banana", "cherry"]
for x in fruits:
print(x)
if len(element1) >=4:
do something
Full code as below
fruits = ["apple", "banana", "cherry"]
for x in fruits:
if len(x) >=4:
print(x)
You can check the element lenght is greater than four then you can add them into the desired list
new_elements =[element for element in things if len(element)>=4]
print(new_elements)