Skip to content
Prev Previous commit
Next Next commit
29-remove-duplicate-words
  • Loading branch information
kiddopro committed Mar 2, 2022
commit 8eb00be511feadc00604e4217bea45fbd80f2785
3 changes: 3 additions & 0 deletions exercises/29-remove-duplicate-words/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
s = input()
words = [word for word in s.split(" ")]
print (" ".join(sorted(list(set(words)))))
4 changes: 2 additions & 2 deletions exercises/29-remove-duplicate-words/solution.hide.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
s = raw_input()
s = input()
words = [word for word in s.split(" ")]
print " ".join(sorted(list(set(words))))
print (" ".join(sorted(list(set(words)))))
9 changes: 9 additions & 0 deletions exercises/29-remove-duplicate-words/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import pytest, io, sys, json, mock, re, os

@pytest.mark.it('')
def test_expected_output(capsys, app):
fake_input=['Hola como Hola']
with mock.patch('builtins.input', lambda x: fake_input.pop()):
app()
captured = capsys.readouterr()
assert captured.out != " como \n"