Ad
  • Custom User Avatar

    Simpler, faster algorithms are more maintainable and consume fewer resources. Seems to me like you didn't notice that there was a more efficient solution than the one you created, and now you're trying to turn that into a virtue instead of trying to learn from it. OK, so you didn't optimize the algorithm as much as it can be optimized. It didn't matter for this problem. But if you want to learn to write efficient code, I think this is a really valuable lesson to learn.

  • Custom User Avatar

    It's about writing a piece of code that solves a specified problem, and it's about having fun. Don't get surly because other people found a more clever way to solve the problem than you did, it makes you look petty.

  • Custom User Avatar

    Some of these kata, you know what you're getting into when you take it on. This is not one of those kata, but it didn't punish me too badly for daring to take it on. Thanks!

  • Custom User Avatar

    It doesn't seem like SQL kata are particularly popular on CodeWars, so you're right that it's probably not worth it to add additional dialects. But some of the languages they already support are pretty obscure, so I'll keep my fingers crossed for MySQL, Oracle, or MS SQL Server ;)

  • Custom User Avatar

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

  • Custom User Avatar

    And yet, lots of other people did figure this out, so what does that say?

  • Custom User Avatar

    Don't. You found a solution and then you went back and optimized it after the code was already working. That's a good thing and nothing to feel bad about.

  • Custom User Avatar

    I thought it would be interesting to sort your reply:

    ((((((((((((((((((((((((()))))))))))))))))))))))))**********************
    +++++++++-----------------......000000111111111111111111111112222222222222222222555555;;
    ===========nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnr

  • Custom User Avatar

    They are defined already as part of the kata, just not in the part of the code that you can edit.

  • Custom User Avatar

    Obviously, given that you have max, you can implement a prime number sieve if you want. There are a zillion kata on here that ask you to do just that.

  • Custom User Avatar

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

  • Custom User Avatar

    You're writing programs about things. If the things you're writing the program about are mathematical, then you'll obviously need to know enough math to understand what your program needs to do. There are other problems that require very little math. For example, a web site that allows a user to browse a catalog might use some math in the layout code, or to track items in a shopping cart, but that's a very low ratio of math needed per basic unit of functionality in the code. Then, there are a whole class of problems that don't seem like they'd require a lot of math, but turn out to be very heavily mathematical. For example, computer graphics, AI, and sound processing are all very heavily mathematical, even if it doesn't seem like they would be.

  • Custom User Avatar

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

  • Custom User Avatar

    The radius parameter in calculate_volume is a float. So, be sure to use float(radius) in your calculation.

  • Custom User Avatar

    If total_slices is a number, you have to turn it into a string before you can concatenate it with ": It must be dinner time!". Try:

    print(str(total_slices) + ": It must be dinner time!")

  • Loading more items...