The in operator returns True if a specified substring is found in a string.
def in_oper(s1, s2):
result = s1 in s2
return result
Function Call | Return Value | |||
---|---|---|---|---|
in_oper('e', 'Hello') | → | |||
in_oper('g', 'Hello') | → | |||
in_oper('2', '525') | → | |||
in_oper('74', '525') | → | |||
in_oper('gg', 'Egg') | → | |||
in_oper('', 'World') | → | |||
in_oper(' ', 'Hello World') | → | |||
in_oper(' ', 'HelloWorld') | → |
Experiment with this code on Gitpod.io