Ad
  • Custom User Avatar

    This doesn't check that the result is the same as the input. With the example test the 1st and 2nd "l"s from "hello" can be swapped but the result is still "hello"

    simple test I ran (I'm fairly new to python so this might not be the best way to do it)
    for i in range(11):
    print(mix_words('hello'))
    for i in range(11):
    print(mix_words('hello, Pippi!'))

    output:
    hlelo
    hlelo
    hlleo
    hello -- Should fail?
    hlleo
    hello -- Should fail?
    hlleo
    hlleo
    hlelo
    hlleo
    hello -- Should fail?
    hlleo, Ppipi!
    hlleo, Pippi! -- 2nd word should fail?
    hello, Pppii! -- 1st word should fail?
    hlelo, Ppipi!
    hlelo, Pppii!
    hlleo, Ppipi!
    hlleo, Pppii!
    hello, Pppii! -- 1st word should fail?
    hlleo, Ppipi!
    hlleo, Ppipi!
    hello, Pippi! -- Should fail?

  • Custom User Avatar

    This gives me an error "NameError: name 'basestring' is not defined"

    I'm fairly new to Python. Does anyone understand what is happening here? How has this passed the tests on codewars and what are the Best Practices that people are upvoting for?