Ad
  • Custom User Avatar

    Amazing amazing! I appreciate this soltion to help me revise Try Except! :)

  • Default User Avatar

    OmG 😢😢.
    that was a bit similar to mine, but i should have thought of that.
    anyways i dont know how i succeded😅😅

  • Default User Avatar
  • Custom User Avatar

    But if the function gets called like last("hi", "bye") this would return "e" and from what I understood this should return "bye" with that input.
    It seems the kata needs more tests or clarify that in the instructions.

  • Custom User Avatar

    Not best practice. Bare excepts are a good example of what NOT to do. If you want to handle an exception, handle that specific exception, e.g.: except TypeError:

  • Custom User Avatar

    can you please explain why number*=10

  • Custom User Avatar

    When a parameter is called with an asterisk (*args), it can accept multiple arguments and will return the arguments as a tuple.

    If the argument tuple is nested (that is, another array is inside of it) you can call the last element in that array inside the tuple. Array[-1] gets the last item and if that item is a nested array then Array[-1][-1] will be needed to look at last element in that.

    Example:

    (5, 2, 5, [1, 2, 3, 4])[-1]  - last item in tuple is [1, 2, 3, 4] because the list counts as one item
    
    (5, 2, 5, [1, 2, 3, 4])[-1][-1]  =  [1, 2, 3, 4][-1]  - last item of the list (in the tuple) is 4
    
    so (5, 2, 5, [1, 2, 3, 4])[-1][-1] == 4
    

    TL;DR It looks at nested items from the tuple argument.

  • Custom User Avatar

    what does args[-1][-1] do? I can't find the answer online.