PGoCareerGoCareer prep tools
Home
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

Python · Theory

Python Tuples

← All stacks

Theory

32/268

Python Tuples

A tuple is an ordered collection that cannot change after you create it. t = (3, 4) is a point. t[0] = 9 raises TypeError. No append, no remove. Use it for fixed records and as dict keys when the items are hashable. Syntax is parentheses, or even 1, 2, 3 without them.

One-item trap: (42,) is a tuple. (42) is just the int 42 in brackets. Freshers miss the comma and then wonder why t[0] fails. Interview line: ordered + immutable.

Python Tuples — output — 7. Uncomment assignment and it crashes — tuple cannot change.

Diagram
point = (3, 4)   immutable
     x=3     y=4
Exam tip

(42,) vs (42) trap.

Example

# Tuples
point = (3, 4)
x, y = point
print(x + y)
# point[0] = 9  # TypeError

Python Tuples — output: 7. Uncomment assignment and it crashes — tuple cannot change.

Short notes

  • DefOrdered + immutable.
  • Rule(42,) needs the comma.
  • UseFixed records / dict keys.

Questions

1

Explain Tuples as if you are teaching a junior — definition, then one tiny script.

2

What does the example print, and why?

3

What mistake do freshers make with Tuples?

Previous← Python List MethodsNextPython Tuple Methods →
P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.