Feb-23-2017, 11:07 AM
You should use python code tags to make your code more readable and to keep an indentation right (your third return statement is clearly misindented).
Little problem with your solution is that an empty string is not a string consisting of single space. Evaluation of an empty string is not covered with visible tests, so it is not catched. With that corrected it should work.
You can use len(x) == len(set(x)) for shorter, but maybe less readable check.
Little problem with your solution is that an empty string is not a string consisting of single space. Evaluation of an empty string is not covered with visible tests, so it is not catched. With that corrected it should work.
You can use len(x) == len(set(x)) for shorter, but maybe less readable check.