• Sign Up
    Time to claim your honor
  • Training
  • Practice
    Complete challenging Kata to earn honor and ranks. Re-train to hone technique
  • Freestyle Sparring
    Take turns remixing and refactoring others code through Kumite
  • Community
  • Leaderboards
    Achieve honor and move up the global leaderboards
  • Chat
    Join our Discord server and chat with your fellow code warriors
  • Discussions
    View our Github Discussions board to discuss general Codewars topics
  • About
  • Docs
    Learn about all of the different aspects of Codewars
  • Blog
    Read the latest news from Codewars and the community
  • Log In
  • Sign Up
PureAssumption Avatar
Name:Unknown
Clan:Unknown
Member Since:Jan 2019
Last Seen:Apr 2023
Profiles:
    Following:0
    Followers:0
    Allies:0
    View Profile Badges
    • Stats
    • Kata
    • Collections
    • Kumite
    • Social
    • Discourse
    • Conversations (16)
    • Replies
    • Authored
    • Needs Resolution
    • Custom User Avatar
      • PureAssumption
      • commented on "Remove the time" kata
      • 7 years ago

      Great Kata!

    • Custom User Avatar
      • FArekkusu
      • created an issue for "21 Sticks" kata
      • 7 years ago

      The function name should be in snake_case in Python.

    • Custom User Avatar
      • FArekkusu
      • created an issue for "21 Sticks" kata
      • 7 years ago

      Inside tests:

      number = 21
      while number > 0:
          # some code
          number -= myMove(number)
      

      Inside myMove function:

      def myMove(n):
          # some code
          if LOSE_CONDITION:
              return 'Computer won!'
          # some more code
      

      These leads to TypeError: unsupportd operand type(s) for -=: 'int' and 'str' being raised if the user's algorithm is incorrect.

    • Custom User Avatar
      • FArekkusu
      • created an issue for "21 Sticks" kata
      • 7 years ago
      m = makeMove(number)
      test.expect(m in range(1, 4), 'Your robot returned %s!' % m)
      test.expect(m % 1 == 0, 'Your robot returned %s!' % m)
      
      1. The second test is useless, and should be removed.
      2. The error messages do not give any insight in why the returned value is wrong.
    • Custom User Avatar
      • FArekkusu
      • commented on "21 Sticks" kata
      • 7 years ago

      Okay, I take that back. Turns out the tests are even worse than I thought at first.

      But, this changes nothing. You receive this error, because reference function returns "Computer won!", so your algorithm is still incorrect.

    • Custom User Avatar
      • PureAssumption
      • commented on "21 Sticks" kata
      • 7 years ago

      But its not, it returns int

    • Custom User Avatar
      • FArekkusu
      • resolved an issue on "21 Sticks" kata
      • 7 years ago

      Your code is wrong, and returns a string instead of a number.

    • Custom User Avatar
      • FArekkusu
      • created an issue for "21 Sticks" kata
      • 7 years ago
      number = 21
      for TEST in range(0, 3):
          test.expect(makeMove(number) in range(1, 4), 'Did not return a number between 1 and 3')
          number -= makeMove(number)
      

      This test makes no sense, as it means the same player taking 3 turns in a row.

    • Custom User Avatar
      • PureAssumption
      • created an issue for "21 Sticks" kata
      • 7 years ago

      Very disappointed with this kata, at first it was unclear what i suppose to do. Than, when i got it and passed all the tests, this annoying [TypeError: unsupportd operand type(s) for -=: 'int' and 'str'".] appeared out of nowhere, and i can't resolve it, but i have to, to get a course certificate in my school!

    • Custom User Avatar
      • PureAssumption
      • commented on "21 Sticks" kata
      • 7 years ago

      Damn it! I got it too, has anyone resolved this Error?

    • Custom User Avatar
      • PureAssumption
      • commented on "Find the calculation type" python solution
      • 7 years ago

      Oh, i got it! Damn thats clever!

    • Custom User Avatar
      • rowcased
      • commented on "Find the calculation type" python solution
      • 7 years ago

      This comment is hidden because it contains spoiler information about the solution

    • Custom User Avatar
      • antobusss
      • commented on "Find the calculation type" python solution
      • 7 years ago

      Why res in square brackets?

    • Custom User Avatar
      • rowcased
      • commented on "Find the calculation type" python solution
      • 7 years ago

      This comment is hidden because it contains spoiler information about the solution

    • Custom User Avatar
      • PureAssumption
      • commented on "Find the calculation type" python solution
      • 7 years ago

      How does this work? Never seen this before

    • Loading more items...
    • © 2025 Codewars
    • About
    • API
    • Blog
    • Privacy
    • Terms
    • Code of Conduct
    • Contact

    Confirm

    • Cancel
    • Confirm

    Collect: undefined

    Loading collection data...