mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-14 13:28:03 +00:00
new challenge: reverse_words
This commit is contained in:
16
arrays_strings/reverse_words/reverse_words_solution.py
Normal file
16
arrays_strings/reverse_words/reverse_words_solution.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from nose.tools import assert_equal
|
||||
|
||||
class UnitTest (object):
|
||||
def testReverseWords(self, func):
|
||||
assert_equal(func('the sun is hot'), 'eht nus si toh')
|
||||
assert_equal(func(''), None)
|
||||
assert_equal(func('123 456 789'), '321 654 987')
|
||||
assert_equal(func('magic'), 'cigam')
|
||||
print('Success: reverse_words')
|
||||
|
||||
def main():
|
||||
test = UnitTest()
|
||||
test.testReverseWords(reverse_words)
|
||||
|
||||
if __name__=="__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user