Пример #1
0
 def test_rotate(self):
     self.assertEqual("llohe", rotate("hello", 2))
     self.assertEqual("hello", rotate("hello", 5))
     self.assertEqual("elloh", rotate("hello", 6))
     self.assertEqual("llohe", rotate("hello", 7))
Пример #2
0
 def test_rotate(self):
     self.assertEqual("llohe", rotate("hello", 2))
     self.assertEqual("hello", rotate("hello", 5))
     self.assertEqual("elloh", rotate("hello", 6))
     self.assertEqual("llohe", rotate("hello", 7))
Пример #3
0
"""
Given a strings s and int k, return a string that rotates k times
For example,
rotate("hello", 2) return "llohe"
rotate("hello", 5) return "hello"
rotate("hello", 6) return "elloh"
rotate("hello", 7) return "llohe"
accepts two strings
returns bool
"""

from algorithms.strings import rotate

print(rotate("hello", 2))  #return "llohe"
print(rotate("hello", 5))  #return "hello"
print(rotate("hello", 6))  #return "elloh"
print(rotate("hello", 7))  #return "llohe"