Python Concat Strings
We can use '+ ' on strings to attach a string at the end of another string. This operator '+' is called addition operator when used on numbers. But, when used on strings, it is called 'concatenation ' operator since it joins or concatenates the strings.
concat strings example:Adding two Strings:
s1='Core' s2="Python" s3=s1+s2 print(s3) CorePython
We can check if a string or character is a member of another string or not using 'in' or 'not in' operators. The 'in ' operator returns True if the string or character is found in the main string. It returns False if the string or character is not found in the main string. The 'not in' operator returns False if a string or character is not found in the main string, otherwise True. The operators 'in' and 'not in' make case sensitive comparisons . It means these operators consider the upper case and lower case letters or strings differently while comparing the strings.
str = input('Enter main string:') sub = input('Enter sub string:') if sub in str: print(sub+' is found in main string') else: print(sub+' is not found in the main string')