Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Write a Python program to accept two strings as input and check if they are identical copy of each other or if the second string is a substring of the first string.

ss='Hello w'
ms='Hello world'

if(ss==ms):
    print( 'Both the strings are same')

elif(ms.find(ss)!=-1):
    print ('{0} is a substring of {1}'.format(ss,ms))

else:
    print ('None')
 
PREVIOUS NEXT
Tagged: #Write #Python #program #accept #strings #input #check #identical #copy #string #substring
ADD COMMENT
Topic
Name
6+8 =