PythiloLesson 1 of 30 · progress kept in this browser

Values and names

Everything Python works with is a value, and every value has a type. A name is a label that points at a value. Assignment with = attaches the label. It never copies anything.

a = [1, 2]
b = a        # same list, two names
b.append(3)
print(a)     # [1, 2, 3]
a = "text"   # a now points elsewhere
print(b)     # still [1, 2, 3]
Your task

Write describe(value) returning "<type name>: <repr of value>", and swap(a, b) returning (b, a). At the end of the file, print describe(42).