Ad
  • Custom User Avatar

    Yes. :)
    It's called a "ternary operator" if you want to look up more information about it.

  • Default User Avatar

    A random number from 1 to 1000 is generated when an Guesser object is created.

    The Guesser has a method "guess(number)" that compares the parameter "number" with the randomly generated number and returns a string based on the result of the comparison ("Too high!", "Too low!", or "Correct!").

    The "guess(number") method can only be called 10 times, it will raise an error if it is called more than 10 times.

    Your task is to implement the method "get_number()" that will try to determine what the randomly generated number is by calling the "guess(number)" method up to 10 times (and using the returned string to make better guesses). When the correct number is determined, the method "get_number()" should return it.

    It took me some time to understand this kata. It is a bit poorly worded. Hopefully this will help you. :)

  • Default User Avatar

    Maybe it was Christmas Day when this solution was submitted ?

  • Default User Avatar

    Isn't 1 a power of 2 ?

    2 ** 0 = 1 ?

  • Default User Avatar

    Isn't 1 a power of 2 ?

    2**0 = 1 ?