Ad
  • Custom User Avatar

    Please read this first: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution

    And then the error message:

    Traceback (most recent call last):
      File "main.py", line 4, in <module>
        Test.assert_equals(encrypt("This is a test!", 0), "This is a test!")
      File "/home/codewarrior/solution.py", line 5, in encrypt
        return encrypt(text, n)
      File "/home/codewarrior/solution.py", line 5, in encrypt
        return encrypt(text, n)
      File "/home/codewarrior/solution.py", line 5, in encrypt
        return encrypt(text, n)
      [Previous line repeated 995 more times]
      File "/home/codewarrior/solution.py", line 2, in encrypt
        while n < 1:
    RecursionError: maximum recursion depth exceeded in comparison
    

    You have an infinite loop in your code (check that exact input in your IDE). Not a kata issue.

  • Custom User Avatar

    That's the case for most katas. If your function isn't pure, such errors are to be expected.

  • Custom User Avatar

    You are using a global variable: correct_number, which would just accumulate the data from last function call.

    You should put the declaration inside the function body to store only relevent stuff.