Introductory Python course I need it to use simple function

Introductory Python course - I need it to use simple functions, and no \"flags\" or any advanced stuff like that. Thanks!

4. Write a function that takes, as an argument, a list and a string, and returns a Boolean based on whether or not all of the letters in the string appear somewhere in the list. Name your function findLetters(myList, myString). For example, find Letters([\"hello\", \"world\", \"hold\") should return True, and find Letters hello world\", \"down\") should return False.

Solution

Answer:

def findLetters(myList,myString):

empstr=\'\'

for m in myList:
empstr+=m

for d in myString:
if empstr.count(d) == 0:
return False
return True


lst=[\"hello\",\"world\"]
char=\"down\"
print(findLetters(lst,char))

Introductory Python course - I need it to use simple functions, and no \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site