diff --git a/bit_manipulation/binary_and_operator.py b/bit_manipulation/binary_and_operator.py index e5dffe3e31d2..f1b910f8cc9b 100644 --- a/bit_manipulation/binary_and_operator.py +++ b/bit_manipulation/binary_and_operator.py @@ -1,5 +1,6 @@ # https://www.tutorialspoint.com/python3/bitwise_operators_example.htm + def binary_and(a: int, b: int): """ Take in 2 integers, convert them to binary, diff --git a/bit_manipulation/binary_xor_operator.py b/bit_manipulation/binary_xor_operator.py index 32a8f272116e..0edf2ba6606d 100644 --- a/bit_manipulation/binary_xor_operator.py +++ b/bit_manipulation/binary_xor_operator.py @@ -1,5 +1,6 @@ # https://www.tutorialspoint.com/python3/bitwise_operators_example.htm + def binary_xor(a: int, b: int): """ Take in 2 integers, convert them to binary, diff --git a/strings/remove_duplicate.py b/strings/remove_duplicate.py index 6357050ac17d..5ab0e9962752 100644 --- a/strings/remove_duplicate.py +++ b/strings/remove_duplicate.py @@ -1,14 +1,15 @@ -""" Created by sarathkaul on 14/11/19 """ - - def remove_duplicates(sentence: str) -> str: """ - Reomove duplicates from sentence + Remove duplicates from sentence >>> remove_duplicates("Python is great and Java is also great") 'Java Python also and great is' + >>> remove_duplicates("Python is great and Java is also great") + 'Java Python also and great is' """ - return " ".join(sorted(set(sentence.split(" ")))) + return " ".join(sorted(set(sentence.split()))) if __name__ == "__main__": - print(remove_duplicates("INPUT_SENTENCE")) + import doctest + + doctest.testmod()