70 970
Assignments Done
98,9%
Successfully Done
In March 2019

Answer to Question #86406 in Python for Kirsten

Question #86406
Given the string, s, and the list, lst, associate the variable contains with True if every string in lst appears in s (and False otherwise). Thus, given the string Hello world and the list ["H", "wor", "o w"], contains would be associated with True.
Expert's answer
# given string
s = "Hello world"


# and list
lst = ["H", "wor", "o w"]


# check if every item in list appears in string
contains = all(item in s for item in lst)


# print result (True/False)
print(contains)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions