• Custom User Avatar

    IMO it should be 3 not 7

  • Custom User Avatar

    I'm running into the same issue. I'm not really sure what I've done wrong, but I'm getting hung up on that last test.

    I can modify my code to get the correct answer for that specific instance, but doing so breaks the rest of my responses, so I must be doing SOMETHING wrong, but I can't figure out WHAT.

  • Custom User Avatar

    This one is correct as well.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    No, the last digit is 7.

  • Custom User Avatar

    I got the same error. No idea why this is the case

  • Custom User Avatar

    It's a bit of both.

    Also, your math is wrong. It would be 9, then 7, then 5, then 3.

  • Custom User Avatar

    4 + 4 * 5 does not equal 20.

  • Custom User Avatar

    The math is wrong for this problem. But, so is yours. 5x5 becomes 5 1x5 pieces with 4 cuts. Then 4 cuts for each of the 1x5's to create 25 1x1's. 20 cuts total.

  • Custom User Avatar

    Only reverse words with all five or more letter words as it states it the description. You are reversed all words in the sentence but should only be reversing words where letters > 5.

    Also, why are you using random module, the words should be reversed only if they have more than 5 letters and should not be reversed based on randomness.

  • Custom User Avatar

    Fixes:

    1. The return reserved keyword will break out of the for loop and will not continue if true. This meaning that if the expression evaluates as true, then it will break out of both the for loop and the function. Thus, not every value in the array is checked, it may possibly break out on the first loop.
    2. You shouldn't compare whether or not the element is an array using type(arr) since it won't work for other iterators, what if you were given a string? A string is an iterator and taking the type of this would evaluate as true; therefore, make sure you use isinstance(i, list).

    General Tips:

    1. You should use isinstance() to compare values instead of using type() (as it says in the PEP8 documentation).
    2. The break statement is redundant since the return statement will break out of the loop and function automatically.

    (I'm assuming the indentation - you should use markdown to format your code)

  • Custom User Avatar

    What language is this? I only know Javascript so I can't help you with this one, sorry.