from operator import contains as common_substring def common_substring(string, sub_str): # Write your code here if sub_str in string: return True else: return False
from operator import contains as common_substring- from operator import contains as common_substring
- def common_substring(string, sub_str):
- # Write your code here
- if sub_str in string:
- return True
- else:
- return False
# TODO: Replace examples and use TDD development by writing your own tests # These are some of the methods available: # test.expect(boolean, [optional] message) # test.assert_equals(actual, expected, [optional] message) # test.assert_not_equals(actual, expected, [optional] message) # You can use Test.describe and Test.it to write BDD style test groupings test.assert_equals(common_substring("Hello", "lo"), True) test.assert_equals(common_substring("HELLO", "hello"), False) test.assert_equals(common_substring("racecar", "car"), True) test.assert_not_equals(common_substring("rororororor", "roror"), False, ) test.expect(str,)
- # TODO: Replace examples and use TDD development by writing your own tests
- # These are some of the methods available:
- # test.expect(boolean, [optional] message)
- # test.assert_equals(actual, expected, [optional] message)
- # test.assert_not_equals(actual, expected, [optional] message)
- # You can use Test.describe and Test.it to write BDD style test groupings
- test.assert_equals(common_substring("Hello", "lo"), True)
- test.assert_equals(common_substring("HELLO", "hello"), False)
test.assert_equals(common_substring("racecar", "car"), True)- test.assert_equals(common_substring("racecar", "car"), True)
- test.assert_not_equals(common_substring("rororororor", "roror"), False, )
- test.expect(str,)