Ad
  • Custom User Avatar

    I'll start with a basic explanation. print just shows the human user a string representing what is going on inside the computer. The computer cannot make use of that printing. return is how a function gives back a value. This value is often unseen by the human user, but it can be used by the computer in further functions.

    On a more expansive note, print will not in any way affect a function. It is simply there for the human user's benefit. It is very useful for understanding how a program works and can be used in debugging to check various values in a program without interrupting the program.

    return is the main way that a function returns a value. All functions will return a value, and if there is no return statement (or yield but don't worry about that yet), it will return None. The value that is returned by a function can then be further used as an argument passed to another function, stored as a variable, or just printed for the benefit of the human user.

  • Custom User Avatar

    Mine works fine for the letters but where do all the numbers come from in the random tests? Am I supposed to accept outside variables as the array to edit or? How am I supposed to do this

  • Custom User Avatar

    If comments are hidden it is not by me!

  • Custom User Avatar

    Sorry to bother you again I can see that if I would approch this task in another way or do a specific rounding I probably would get the same values as you but without a specification for rounding I can't see why I shouldn't pass the test if I'm off 1 or 2 second (btw I recalculated the values with a calculator and actually my output was way more accurate than yours.)
    Also I don't think hiding all the comments who say that the rounding is way off or not specified enough is the right approach here especially when your test cases seem to be rounded at least in some way.

  • Custom User Avatar

    The tests are the same in all languages and 2882 guys (as you can see at the top of the page) passed the kata.

  • Custom User Avatar

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

  • Custom User Avatar

    when I run the example tests I pass but with the actual tests my code always times out and im not sure why since it prints technically the correct answers if I use print instead of return (but of course it doesnt accept printed answers) but when using return it just times out for some reason.