Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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?
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?