Dec-29-2021, 09:30 AM
Hi @xander ,
Welcome to the forum. It is good you added your code, but please also read how to use BBcode. You have to mark your code and press the "Insert python" button.
But what is your question? Reduce complexity? The code seems quite compact to me. But there are a few things not OK:
Welcome to the forum. It is good you added your code, but please also read how to use BBcode. You have to mark your code and press the "Insert python" button.
But what is your question? Reduce complexity? The code seems quite compact to me. But there are a few things not OK:
- NEVER use built-in names like in
def contain_duplicates(list)
. "list" is a built-in.
- The names you use are not very descriptive. For example: "char1" appears to be a word, not a character. "empty=[]" does not remain empty.