ValueError: need more than 2 values to unpack

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: need more than 2 values to unpack

Solution :

No of variables should be equal to no of elements in sequence or tuple.

Example :

data = [25,"Satya","G",(8,31,2010)]
age,fname,lname,dob = data
print("My name ",fname+lname," and age ",age," dob ",dob)
age,fname,lname,(month,day,year) = data
print("My name ",fname+lname," and age ",age," and year i born :",year)

No comments:

Post a Comment

Featured Post

H1B Visa Stamping at US Consulate

  H1B Visa Stamping at US Consulate If you are outside of the US, you need to apply for US Visa at a US Consulate or a US Embassy and get H1...