Gradient

Courses

∇\nabla∇The maths behind AI0/72
π\piπMaths0/84
⋆\star⋆AI for everyone0/10
Γ\GammaΓGame theory0/49
py\texttt{py}pyPython for AI0/15
y^\hat{y}y^​Build your own AI0/15
All courses

Tuition

My tuition

Practice

ProjectsAsk a questionTrain on a GPUExplorationsMaths StoriesUnsolved problemsPlaygroundScience labs

Reference

GlossaryBlogDiscoveries
Differences › Computer Science

List vs Tuple

A Python list can be changed after it is made; a tuple cannot.

List

An ordered, changeable collection in square brackets: [1, 2, 3].

Tuple

An ordered, unchangeable collection in round brackets: (1, 2, 3).

List compared with Tuple
ListTuple
Brackets[ ]( )
Can add or remove itemsYes: append, remove, popNo
Can be a dictionary keyNoYes
Use forThings that change: a to-do listFixed records: a date, (x, y) point

Example

marks = [70, 80]; marks.append(90) works. point = (3, 4); point[0] = 5 gives a TypeError.

Try it or learn more

  • Class 10 Python lists
  • Class 11 strings and lists

More differences

  • RAM vs ROM
  • Hardware vs Software
  • Compiler vs Interpreter
  • LAN vs WAN
  • HTTP vs HTTPS