Skip to main content
removed unnecessary whitespace
Source Link
Varicus
  • 131
  • 3

Python - 1312

not ({a}-{b})

This solution uses sets. Subtracting equal sets will result in an empty set, which has a boolean value of False. Negating that will result in a True value for a and b being equal strings.

>>> a="string1"
>>> b="string2"
>>> not ({a}-{b})
False

>>> a="string"
>>> b="string"
>>> not ({a}-{b})
True

Edit: Thanks to Peter Taylor for pointing out the unnecessary whitespace.

Python - 13

not ({a}-{b})

This solution uses sets. Subtracting equal sets will result in an empty set, which has a boolean value of False. Negating that will result in a True value for a and b being equal strings.

>>> a="string1"
>>> b="string2"
>>> not ({a}-{b})
False

>>> a="string"
>>> b="string"
>>> not ({a}-{b})
True

Python - 12

not({a}-{b})

This solution uses sets. Subtracting equal sets will result in an empty set, which has a boolean value of False. Negating that will result in a True value for a and b being equal strings.

>>> a="string1"
>>> b="string2"
>>> not({a}-{b})
False

>>> a="string"
>>> b="string"
>>> not({a}-{b})
True

Edit: Thanks to Peter Taylor for pointing out the unnecessary whitespace.

Source Link
Varicus
  • 131
  • 3

Python - 13

not ({a}-{b})

This solution uses sets. Subtracting equal sets will result in an empty set, which has a boolean value of False. Negating that will result in a True value for a and b being equal strings.

>>> a="string1"
>>> b="string2"
>>> not ({a}-{b})
False

>>> a="string"
>>> b="string"
>>> not ({a}-{b})
True