//sample solution
Allergic to Peanuts?
Let's combine a few concepts you've learned in this lesson so far for this last exercise.
You have a recipe book stored as a string in the variable book, and you want to see if the first half of the book contains the word "peanut". Check if the first half of the string stored in book contains the string "peanut".
"peanut" in book[0:len(book)/2]
=> True
Don't eat this if you're allergic to peanuts! Congratulations on completing your third Python lesson!
No comments:
Post a Comment