-1

I've been studying the Python textbook "Automate the boring stuff" and doing fine but this task has really stumped me. Been trying to do it for days, but can't get it right. Worst part is, I'm sure it's something kinda simple. What would you consider the best answer? Thank you.

Write an assert statement that triggers an AssertionError if the variables eggs and bacon contain strings that are the same as each other, even if their cases are different (that is, 'hello' and 'hello' are considered the same, and 'goodbye' and 'GOODbye' are also considered the same).

Peter
  • 11
  • 4
  • Convert input string to lowercase and assert that both the input and the converted strings are equal. If the input had capital letters an AssertionError will be raised. – NotAName Oct 21 '22 at 03:53
  • Unicode compare is something of dark art. What happens when a character has only one of the lower/upper case forms? This is worked out in `str.casefold`. So, `assert mystring1.casefold() != mystring2.casefold(), "Strings not the same"`. – tdelaney Oct 21 '22 at 04:11

1 Answers1

0
assert eggs.lower() != bacon.lower()
Pierre D
  • 24,012
  • 7
  • 60
  • 96