0

This is my program:

def main():
    print('This is a program to calculate the setprod')
    print()
    userinput = input('Enter two sets separated by a comma: ')
    value1, value2 = userinput.split(',')
    mylist1 = eval(value1.strip())
    mylist2 = eval(value2.strip())
    print(mylist1 + mylist2)

main()

If I enter following:

>>> 
This is a program to calculate the setprod

Enter two sets separated by a comma: set([2]), set([3])

I get this error:
print(mylist1 + mylist2)
TypeError: unsupported operand type(s) for +: 'set' and 'set'

How do I fix this problem?

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by simpatar
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.