Ad
  • Custom User Avatar

    It is a string comparison.

    The strings are all like "3:2". So it is "3" > "2" and 3 > 2. String comparison and integer comparison have the same result in this case.

    Here the values are all single digits. The method fails if a string is like "12:8" because "12" < "8" and 12 > 8. However, two-digit results are not part of this kata.

  • Custom User Avatar
    setattr(object, name, value)
        This is the counterpart of getattr(). The arguments are an object, a string, and an arbitrary value.
        The string may name an existing attribute or a new attribute.
        The function assigns the value to the attribute, provided the object allows it.
        For example, setattr(x, 'foobar', 123) is equivalent to x.foobar = 123.