Ad
  • Custom User Avatar
  • Default User Avatar

    Thank you for you comments. I have already fixed what you pointed out.

  • Custom User Avatar

    For some reason an actual apostrophe symbol () is used instead of a single quote ('), but it's not mentioned in the description, and they're almost indistinguishable visually (unless you stare hard enough into those pixels to notice that something's off). Have fun debugging looking at 2 identical strings trying to understand why you can't pass the tests.

  • Custom User Avatar

    Duplicate of any other "format variable into a string" kata.

  • Custom User Avatar

    Note that your code should return joke written in several lines, as shown on the example.

    Description formatting is wrong.

  • Custom User Avatar

    No random tests.

  • Custom User Avatar

    No sample tests.

  • Custom User Avatar

    Please, before saying it has nothing to do with your issue, have you tried your code with a single digit number? I've added the if and your code worked.
    Note that in your properly formatted code, you have n_ stand it should be n_st instead.

  • Default User Avatar

    you are right, i forgot to include it but it has nothing to do with my issue.

  • Custom User Avatar

    Your code is failing with single digit numbers. Why did you remove the if?

  • Default User Avatar

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

  • Default User Avatar

    Thank you for advices, I am new on this platform. You didnot get it right, i updates only in else, so it is

    ('n is', 12)
    ('Length of n is:', 2)
    ('We are in if', 'i is', 1, 'equal is ', 0, 'remainings are:', '1', '2')
    ('Out of while, i is', 1)
    ('sorted last digits are:', '21', '1', 'index is', 1, 'need to find ', '1')
    

    it is not resolved. It passes all the test everytime. there is 0 failed. But Exit Code: 1 is still there

    Traceback (most recent call last):
    File "main.py", line 41, in <module>
    Test.assert_equals(next_bigger(n),next_sol(n),"It should work for random inputs too")
    File "/home/codewarrior/solution.py", line 25, in next_bigger
    idx = inv.index(n_st[-(i+1)]) 
    IndexError: string index out of range
    
  • Custom User Avatar

    Mark your post as having spoiler content next time, please. And also, it's a problem with your code, so use Question instead of issue, see how many Python completions there already are:

    Python Completions 2606

    When posting code, try using proper markdown too, because in Python indentation is important.

    If what I think is right this is the output to the console with your code (I had to guess how the indentation was because it was lost):

    ('n is', 12)
    ('Length of n is:', 2)
    ('We are in if', 'i is', 1, 'equal is ', 0, 'remainings are:', '1', '2')
    ('Out of while, i is', 2)
    

    And you can see when you use this:

    idx = inv.index(n_st[-(i+1)])
    

    The index (-3) is out of range.

  • Default User Avatar

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