Comprehensions and functional programming · 14 / 15 Exercise Easy

Number the lines

Objective

Create a Python program that numbers a list of lines of text using enumerate.

Instructions

  • Read an integer n and then n lines of text.
  • Loop over them with enumerate, starting to count at 1.
  • Show each line with the format number. text.
Input
3
comprar pan
estudiar Python
hacer deporte
Output
1. comprar pan
2. estudiar Python
3. hacer deporte

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise