The teacher is obviously using a better way. Check/read more about time complexity for lists in python here (python wiki).
In your case, you are going for a time complexity:
\$ O(n) \$ for iteration
\$ O(n) \$ for .count()
\$ O(n) \$ for intermediate pop
\$ O(n) \$ for .index
for a final (worst case) time: \$ O(n^2) \$ (see explanation in comments from ...
Your teacher's approach is better than yours, the main reason is the one noted in the answer by @hjpotter92.
However, their approach can be optimized even more. Note that there is the \$O(k)\$ check from not in. This is because when you check if an element is in a list, it goes through the whole list and tries to find it.
A set on the other hand stores ...
numbers.pop(numbers.index(i)) is equivalent to numbers.remove(i).
Given that your example lists are sorted and that your solution would fail for example [1, 3, 1, 2, 3, 2] (which it turns into [3, 1, 3, 2], not removing the duplicate 3), I'm going to assume that the input being sorted is part of the task specification. In which case that should be taken ...
The following are a few suggestions on how I'd write the SQL.
If you don't already have a database project, create one in Visual Studio. Then check it in to source control. Microsoft Azure DevOps Services is free & private for teams of 5 or less (this is per project, so 5 developers per project). Then you'll be able to track changes you ...
It is difficult to tell "which one is better". As Jan mentioned in a comment:
"tell which one is better" - what does "better" mean? performance? code readability? ... ?
The notion of better is subjective.
I am drawn to the first solution as it uses the fewest lines, though readability suffers because the lines are quite long ...