Ad
  • Custom User Avatar

    I guess 8kyu for the long way, but right way is definitely at least 7kyu

  • Custom User Avatar

    the code also works fine in visual studio code, but does not work on when i test it on codewars

    this is a common expression but almost always seems to mean that you didn't do the same thing locally. use the same test case as what failed, make sure it's called correctly, or failing that, debug it in the codewars environment instead

    to clarify it is saying "found" has no value

    don't paraphrase error messages, because when you do then you can only relay the things you noticed about it which doesn't help when you're missing something about it. and "it is saying" - what entity is "it"?

    I'm guessing you mean:

    UnboundLocalError: cannot access local variable 'x' where it is not associated with a value

    here's a simple program with an obvious problem in it that produces that error message:

    def f():
        if x:
            pass
        x = 3
    
    f()
    
  • Custom User Avatar

    to clarify it is saying "found" has no value

  • Custom User Avatar

    the code also works fine in visual studio code, but does not work on when i test it on codewars

  • Custom User Avatar
        else:
            found = False
    if not found:
        print('Welcome')
    

    can anyone explain why am i getting an error on line if not found: saying it has no value?
    i tried using a return statement in all 3 areas possible above the if not found: still same error.

  • Custom User Avatar

    Good practice for an extremely useful feature, especially if you dig deeper into why.

  • Custom User Avatar

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

  • Custom User Avatar

    Chinese are 1.5 billion and Indians 1.4 billion. But noone actually asked why they are not included unlike some imperialists.

  • Custom User Avatar

    Goed dag, flemish is similar to dutch (holland) welcom it is welkom then:) thaks anyway for the exe

  • Custom User Avatar

    Actually for Lithuanian it's "Sveiki atvykę" or just "Sveiki" =)

  • Custom User Avatar

    Great solution! Is this considered better practice than using the Number.isInteger() javascript function? Perhaps it's faster?

  • Custom User Avatar

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

  • Custom User Avatar

    This would require to update all languages, so not ideal. Also, users can train on how to write their own dictionary or hashmap that way!

  • Custom User Avatar

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

  • Custom User Avatar

    OP solved it, closing

  • Loading more items...