Ad
  • Custom User Avatar

    there's a major difference between being a novice and not knowing even the most basic syntax of any programming language. this website is not necessarily for learning "hello world", even the simplest kata requires working knowledge of programming fundamentals and the syntax of whatever language you're working with. you can try to teach yourself all of this by staring at code you don't understand for hours, or (what you should do), watch youtube videos or read online guides to get a feel for programming in your preferred language (probably Python) first.

    FYI i've been programming for years and i still consider myself very much a novice. it will probably take you a VERY long time and a significant amount of effort before you find solving problems easy.

  • Custom User Avatar

    It's also a game/challenge, and these are all good opportunities to learn different methods to do things. And in a production environment might not have the option to change language but can still make the code run faster where and how we can.

  • Default User Avatar

    Ok, but this kumite uses python in tests and I'm too lazy to write a translation to C.

  • Custom User Avatar

    If I was worrying about the cost of operations like division, I wouldn't be using Python.

  • Custom User Avatar

    If you know what format the temperature is coming in already, you can just check it against the type to convert to. There is no such thing as "both". It is one or the other. Whenever you use both, the calculation for the same type of temperature will always be wrong (input fahrenheit, convert with "both", output fahrenheit will be different because it was treated as celcius).

    EDIT: Ok, I see - it is tested upon and expected to work that way. Still a dumb idea. One will always be wrong, why bother.

  • Default User Avatar

    Division is a slow operation, it's a way to reduce its usage.

  • Custom User Avatar

    You are right. I couldn't think of a way to make the previous any faster or more concise :-(

  • Default User Avatar

    This function does a lot of unnecessary calculations including division. If you have to do one conversion - do exactly one instead of 2.