Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/python.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Your friend has become a firm python fanatic,
# to the point where he will only speak in sentences
# that contain all of the letters in the word python
# Your objective is, given a string, return true if
# Your objective is, given a string, return true if
# it contains all the letters p, y, t, h, o, n, and return
# false otherwise

def python(sentence):
pass
letters = set(sentence)
word = 'python'
for c in word:
if c not in letters:
return False
return True
10 changes: 9 additions & 1 deletion src/stringToInt.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# return the int representation of string s
def stringToInt(s):
pass
result = 0
power = 1
sign = 1 - 2*('-' == s[0])
if sign == -1:
s = s[1:]
for c in reversed(s):
result += (ord(c)-ord('0'))*power
power *= 10
return result*sign
4 changes: 2 additions & 2 deletions testing/python_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test2(self):
self.assertEqual(python.python("java"), False)

def test3(self):
self.assertEqual(python.python("pytho?", False)
self.assertEqual(python.python("pytho?"), False)

if __name__ == '__main__':
unittest.main()
unittest.main()