saving . . . saved Getting error in adding tuples has been deleted. Getting error in adding tuples has been hidden .
Getting error in adding tuples
Title
Question
why am i getting an error?

In [27]: person_tuple=(17,"Ram",56.8)

In [28]: t2=("Student")

In [29]: person_tuple
Out[29]: (17, 'Ram', 56.8)

In [30]: person_tuple + t2
---------------------------------------------------------------------
TypeError                           Traceback (most recent call last)
<ipython-input-30-3714b9ddcd0d> in <module>
----> 1 person_tuple + t2

TypeError: can only concatenate tuple (not "str") to tuple

Python-3.4.3 Sequence-datatypes 06-07 min 10-20 sec 10-10-20, 11:36 p.m. swayla1414khanam@gmail.com

Answers:

In order for t2 variable to be recognized as a tuple you have to add a comma separator at the end (after "student")
14-10-20, 10:23 a.m. ankitrj.iitb


Log-in to answer to this question.