Is there a way of ordering a set in base python?
For example:
A = {1, 2, 3}
B = {3, -6, 2, 0}
print union(A, B)
Expected Output:
({-6, 0, 1, 2, 3}, 5)
My attempt:
x = A | B
y = len(x)
print((set(x), y))
My output:
({0, 1, 2, 3, -6}, 5)
I have read some of the answers for other questions and there are ways of doing it with various packages, but for this exercise, I am NOT meant to import any packages, just doing it in base python (if that is what it is called) if possible.