Tuesday, March 27, 2012

exercise 9.4 - uses_only


"""=============================
exercise 9.4
============================="""

def uses_only (word, only_chars):
    for char in word:
        if char.lower() not in only_chars.lower():
            if char != " ": #ignore space character
                return False
    return True
    
print uses_only("Ho ho ho","acefhlo")
print uses_only("Flo ace hoe","acefhlo")

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.