Compare two Strings in python

Description

python program to get two strings and check whether both are equal
Input:
MARK
MAKE
Output:
Not Equal

Solution

s1=input("Enter first String:")
s2=input("Enter first String:")
if(len(s1)==len(s2)):
    for i in range(0,len(s1)):
        if(s1[i]!=s2[i]):
            print("Not Equal")
            break
    else:
        print("equal")
else:
    print("Not Equal")
    
        
    
      

Explanation

if the length of two strings are not equal then strings are not equal else,
visit each location of in strings and compare the characters in s1 and s2.

if all the characters are s1 and s2 are equal then the strings are equal else not equal.



Interesting Pattern Programs: for more Patterns

Input:
5
Output:
*
**
***
****
*****
****
***
**
*Solution
Input:
5
Output:
    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *Solution
Input:
5
Output:
*        *
**      **
***    ***
****  ****
**********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********
**** ****
***   ***
**     **
*       *Solution
Input:
5
Output:
*********
 *******
  *****
   ***
    *
   ***
  *****
 *******
*********Solution