Q. Write a function that receives two string arguments and checks whether they are same-length strings (returns True in this case otherwise false).


You can understand by Watching video :-



Answer :-

def chr(a , b) :
    print( len(a ) == len(b) )

first = input("Enter First String :-")
second = input("Enter Second String :-")

chr(first , second )

Output :-

Enter First String :-Python
Enter Second String :-Portal
True

>>> 

Enter First String :-Path
Enter Second String :-Walla
False

>>> 

Enter First String :-ABCDE
Enter Second String :-VWXYZ
True

>>>


4 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. I guess u should write "Enter a string:" instead of "Enter a number"...likewise for second too

    ReplyDelete
  2. Shouldn't it be :
    if len(a)==len(b):
    return "TRUE"
    else:
    return "FALSE"

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post