What does repr stand for?

repr is fundamental function calling objects __repr__ method. The basic idea of the function is to be string representation of object, which would produce copy of same object if evaluated.

TrustyTony
888
pyMod
Team Colleague
Featured Poster

What does repr stand for?

repr is fundamental function calling objects __repr__ method. The basic idea of the function is to be string representation of object, which would produce copy of same object if evaluated.

Edited
by TrustyTony because:
*
n/a *

arson09
5
Junior Poster in Training

You are still using set at line 3. Use fundamental set definitions. For example union contains all items in first set and items in difference of second and first set.

I'm sorry, that was a copy of my old code. I edited my post and the current code is now up.

arson09
5
Junior Poster in Training

```
def read_set():
stored_set= set(input("Enter the elements of the set(separated with spaces): ").split())
size = len(stored_set)
print ("A set with", size, "elements has been read (repeating items were removed)")
return(stored_set)
def print_set(A):
fixed_set=set()
for element in A:
try:
element=int(element)
fixed_set.add(element)
except ValueError:
print('\n',element,'is not an integer and will not be included in the final set\n')
A=fixed_set
print (A)
return A
def union_set(A,B):
union= A|B
print("\n Union: ", union)
return union
def intersection_set(A,B):
intersection = A&B
print("Intersection: ", intersection)
return intersection
def difference_set(A, B):
difference = A - B
print(" Difference: ", difference)
return difference
def cartprod_set(A, B):
if __name__=="__main__":
print("\nEnter two sets, and i will print the result of some basic set operations on those sets.")
set_one = read_set()
set_two = read_set()
set_one1= set(set_one)
set_two2= set(set_two)
set_one=list(set(set_one))
set_two=list(set(set_two))
print("\nThe two sets you entered are as follows: ")
print_set(set_one)
print_set(set_two)
union_set(set_one1, set_two2)
intersection_set(set_one1, set_two2)
difference_set(set_one1, set_two2)
```

```
Enter two sets, and i will print the result of some basic set operations on those sets.
Enter the elements of the set(separated with spaces): 4 5 3 6
A set with 4 elements has been read (repeating items were removed)
Enter the elements of the set(separated with spaces): 4 3 6 4
A set with 3 elements has been read (repeating items were removed)
The two sets you entered are as follows:
{3, 4, 5, 6}
{3, 4, 6}
Union: {'3', '5', '4', '6'}
Intersection: {'3', '4', '6'}
Difference: {'5'}
```

Edited
by arson09 because:
*
n/a *

JoshuaBurleson
commented:
good job putting in effort
+4

TrustyTony
commented:
Still using the set, even should use list despite advices.
-3

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.