I'm new to coding in Python. I want to split the sentence in the Sample_text into 2 different lists, based on whether the word is a fruit or a non-fruit word, using an if-else loop.
Sample_text = """Blend mangos puree, almond milk, protein powder, peanut butter, and strawberries in a blender until smooth. Serve immediately."""
fruits = ["bannanas","acai","blueberries","strawberries","mangos"]
fruit_words = []
non_fruit_words = []
for word in Sample_text.split(" "):
if
else
Aucun commentaire:
Enregistrer un commentaire