Example #1
0
def test_check_palindrome():
    assert check_palindrome('') == True
    assert check_palindrome('ete') == True
    assert check_palindrome('kayak') == True
    assert check_palindrome('aaaaaaaaaa') == True
    assert check_palindrome('aaabbbaaa') == True
    assert check_palindrome('abc') == False
 def test_check_even_num_nodes(self):
     self.assertTrue(check_palindrome(self.lst3))
     self.assertFalse(check_palindrome(self.lst4))
 def test_check_odd_num_nodes(self):
     self.assertTrue(check_palindrome(self.lst1))
     self.assertFalse(check_palindrome(self.lst2))
Example #4
0
 def test_palindrome(self):
     """Test a palindrome returns true."""
     word = "aabaa"
     assert check_palindrome(word)
Example #5
0
 def test_non_palindrome(self):
     """Test a word which isn't a palindrome returns false."""
     word = "asdkaoskgo"
     assert not check_palindrome(word)
Example #6
0
print("\nREVERSE STRING")
print(reverse_string("hello world !"))

print("\nREVERSE NUMBER (OPPOSITE)")
print(reverse_number(123))
print(reverse_number(-4930))

print("\nREVERSE DIGIT ")

print(reverse_digits(345))

print("\nNUMBER OF WORDS")

print("sentence = Hello World whats up")
print(number_of_words("Hello World whats up"))

print("\nAVERAGE WORD LENGTH")

print("sentence = Hi guys how are you")
print(average_word_length("Hi guys how are you"))

print("\nCHECK PALINDROME")

print("check on 'kayak' and 'oayo'")
print(check_palindrome('kayak'))
print(check_palindrome("oayo"))

print("\nCHECK DUPLICATES")