KnowledgeBoat Logo

Computer Science

What is the difference between (30) and (30,) ?

Python Tuples

25 Likes

Answer

a = (30) ⇒ It will be treated as an integer expression, hence a stores an integer 30, not a tuple.
a = (30,) ⇒ It is considered as single element tuple since a comma is added after the element to convert it into a tuple.

Answered By

12 Likes


Related Questions