PRACTICE

Indexes with enumerate

Lesson notes

Your task

Number ["Ada", "Lin"] starting at 1. Print 1 Ada and 2 Lin on separate lines.

Expected output
1 Ada
2 Lin
Loading…

OUTPUT

Worked solution
names = ["Ada", "Lin"]
for i, name in enumerate(names, start=1):
    print(i, name)

Checks compare printed output, not your approach. Several solutions can be valid.

← Back to courses