Computer Science, asked by hasini5365, 1 month ago

write a program to accept two strings and check whether they are equal or not ignoring the class.​

Answers

Answered by Equestriadash
3

The following co‎des have been written using Python.

\tt s1\ =\ in put("Enter\ a\ string: ")\\s2\ =\ in put("Enter\ a\ string: ")\\if\ s1\ ==\ s2:\\{\ \ \ \ \ }print("They're\ equal.")\\else:\\{\ \ \ \ \ }print("They're\ not\ equal.")

Once both the strings have been entered, we check their equality using a conditional statement, with appropriate messages for both the True and False cases. The '==' operator is used to check for equality between two elements. Since Python is a case-sensitive language, it will take into consideration if the strings are the same and one/two of the characters are in uppercase/lowercase.

An example to demonstrate the case-sensitivity exception has been provided below.

Case 1: [When both the strings are the exact same.]

\tt Enter\ a\ string:\ Vanessa\\Enter\ a\ string:\ Vanessa\\They're\ equal.

Case 2: [When one of the characters is in the opposite case.]

\tt Enter\ a\ string:\ Vanessa\\Enter\ a\ string: vanessa\\They're\ not\ equal.

Similar questions