I don't know why I get an error.
If I erase the ASSERT and run it, I get Success False, what kind of error is it?
python
Hello.
The assert
syntax moves on if the subsequent conditions are true, and causes an Assertion Error if false. This means that AssertionError is not due to any technical problems with the code, but because the assert syntax is false.
assert palindrome("racecar") == "Success"
# Palindrome ("racecar") If return value is "Success", pass
# Failure to do so results in an AssertionError
The palindrome function of the body code is supposed to return True/False instead of Success/Fail string. No matter how hard you try to find out the result, it's useless if the return is not delivered because the return is wrong.
If you modify the function to return the execution result of the function, it will work properly.
You must return Success or Fail. Don't print.
© 2024 OneMinuteCode. All rights reserved.