Python Program to Check if a Substring is Present in a Given String

 

str = input ('Enter String')

word = input ('Enter String to be searched')

str +=' '

len = len(str)

x=''

for i in range (len):

    ch = str[i]

    if (ch!=' '):

        x=x+ch

    else :

        if (x==word):

            print ('Substring is found')

            break

        x=''



Comments

Some popular posts

Python Program that computes the net amount of a bank account based a transaction log from console input.