So I think the issue is the use of the not equals operator (!=). It checks if the thing to the left is not equal to the thing on the right. If I understood your example the check if statement with values witten out would be:
if3!=[3]:print("My unique list:")...
Because, the value on the left is a number and the the value to the right is a list containing the value 3 they will never be equal.
Instead python as two other operators in and not in. Which can be used to check if a values exist in a list (or other container supporting it). In this case the is statement would be:
ifXnotinmyUniqueList:...
Hope this was helpful, feel free to ask any questions if I was unclear😊
So I think the issue is the use of the not equals operator (!=). It checks if the thing to the left is not equal to the thing on the right. If I understood your example the check if statement with values witten out would be:
Because, the value on the left is a number and the the value to the right is a list containing the value 3 they will never be equal.
Instead python as two other operators in and not in. Which can be used to check if a values exist in a list (or other container supporting it). In this case the is statement would be:
Hope this was helpful, feel free to ask any questions if I was unclear😊
Oh, this was really helpful. I was totally unaware of these other operators. The code works fine now. Thanks again!.