Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
The node is an object so I don't think you can print it but you can try to put it in an array then print it so you can see the length
Of course, defining the mod as an external constant is good practice for readability and control :)
It would not make a difference, basic operations on constants like this are optimised away. Try copy the function into a python interpreter, run
from dis import dis
thendis(f)
. You can see that the mod is already calculuated in the bytecode.No problem, and sorry for the wall of text - just thought I'd share some useful starting-out Codewars info.
Good luck with the kata - it's not a basic one, so it's normal to have to work on the complexity a bit. As a small hint, this kata is "intended" to be solved using a certain technique: it can be a good idea sometimes to read the 'tags' in the kata description box to see if you can get any clues on what the topic/technique might be ;)
Hi, first of all welcome to Codewars! As you are new, please know that the Issue tag is only for serious problems with the kata - if you just want help with your solution, please use the Question tag instead.
I recommend as you get started on the site to read this Troubleshooting guide as 95% of all problems are covered there; in this case my guess is that your solution isn't working due to having a "global variable"
d = dict()
that does not change between tests.Try inserting it into your main function definition instead, and it should work.
By the way, you can join the Codewars Discord (link on sidebar on the left) if you want help solving/troubleshooting
edit: also, forgot to say, please learn to use the very simple Codewars markdown to format your code - otherwise it's very hard to get people to read your code when you post it and you're unlikely to get any replies (no-one is going to read through 100 lines of badly formatted text)