Skip to content

Commit ec9c7a4

Browse files
committed
final words
1 parent 88aef8b commit ec9c7a4

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

Day1/words.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ def has_no_e(word):
77

88
def has_no_e(word):
99
return not 'e' in word
10+
#return not 'e' in word.lower()
1011

1112
def uses_only(word1,word2):
1213
"""return true/false if word1 contains only letters from word2"""

Day1/words.py~

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
11

22
def has_no_e(word):
3-
"""return true or false if there is an e in 'word'"""
4-
3+
"""return true or false if there is no e in 'word'"""
4+
for letter in word:
5+
if letter=='e' or letter=='E': return False
6+
return True
7+
8+
def has_no_e(word):
9+
return not 'e' in word
10+
511
def uses_only(word1,word2):
612
"""return true/false if word1 contains only letters from word2"""
13+
for letter in word1:
14+
if not letter in word2: return False
15+
return True
716

817
def uses_all(word1, word2):
918
"""return true/false if word1 uses all the letters in word2"""
19+
for letter in word2:
20+
if not letter in word1: return False
21+
return True
22+
23+
def uses_all(word1, word2):
24+
return uses_only(word2,word1)
1025

1126
def is_abecedarian(word):
1227
"""is the word in alphabetical order?"""
13-
28+
return [letter for letter in word] == sorted(word)
29+
30+
def is_abecedarian(word):
31+
"""is the word in alphabetical order?"""
32+
return word == ''.join(sorted(word))
33+

0 commit comments

Comments
 (0)