closedset = set()
root = (5,6)
for u,v in root:
if v is not closedset:
closedset.add(root)
print closedset
Error:
for u,v in root:TypeError: unpack non-sequence
What should i do with type of error?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not sure I understand what you’re trying to do. Maybe:
Note a few changes:
rootsis now a list of tuples.for u, v in rootswill correctly “unpack” each tuple intouandvif v is not closedyour probably meantif f not in closed, ifclosedis a dictionary of some kindclose.addis a method (of a set?), then it has to be called with parens()and not brackets()