Beautiful code Python
products = ["Red apple", "Green apple", "Green bananas",
"White grapes", "Apple juice"]
list_from_apples = []
print("Then=========================")
for item in products:
if "apple".lower() in item.lower():
list_from_apples.append(item)
print("---", list_from_apples)
print("Now=========================")
list_from_apples = [item for item in products if "apple".lower() in item.lower()]
print("---", list_from_apples)
Индивидуальное, дистанционное обучение Python
подробнее
Возврат к списку