Ad
  • Default User Avatar

    I could use translate and maketrans

  • Default User Avatar

    As @FArrekusu mentioned, it's a duplicate. Don't close the issue please.

  • Custom User Avatar

    Hi,

    Well, you should unpublish it. Mainly because this is a duplicate (that is an "issue", not a "suggestion", actually) of too many katas, but in addition, there is a lot of work to be done to actually have something correct, so not even sure that's worth of your time.

    • the description is wrong:
      • parameters are reversed
      • The offset is how many positions you will shift the word through the alphabet (from 1 - 26) -> wrong: there are tests with offset bigger than 26
    • the solution setup is bad:
      • third parameter that is not described neither called, so useless (you're orienting toward a solution other people might not wanna implement)
      • alphabet should be a string, not a list
      • there is a builtin, for that, => use it
    • the tests are not good/wide enough
      • no fixed tests in the test cases part
      • only single letters are tested
    • last but not least: your code is wrong! code(70,'d') -> 'v' should equal 'w'. Nope, it's "v". If you think it's w, that means your maths are wrong.

    EDIT: Unnamed posted his messages while I was redacting mine

  • Default User Avatar

    Random tests:

    30 w
    'a' should equal 'b'
    

    etc