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.
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.
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.
Ok, but this kumite uses python in tests and I'm too lazy to write a translation to C.
If I was worrying about the cost of operations like division, I wouldn't be using Python.
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.
Division is a slow operation, it's a way to reduce its usage.
You are right. I couldn't think of a way to make the previous any faster or more concise :-(
This function does a lot of unnecessary calculations including division. If you have to do one conversion - do exactly one instead of 2.