Wednesday, July 8, 2015

python program to compare two strings



a = raw_input('Please enter the first string to compare:')
b = raw_input('Please enter the second string to compare: ')

count = 0
if len(a) == len(b):
    while count < len(a):
        if a[count] != b[count]:         
            print ('Strings don\'t match! ')
            break
        else:                             
            count = count + 1
else:
    print "Strings are not of equal length"

No comments:

Post a Comment