Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
enumerate() | For Loops
Python Loops
course content

Зміст курсу

Python Loops

Python Loops

1. While Loops: Get Started
2. While Loops: Essentials
3. For Loops
4. Nested Loops

enumerate()

In case if you need extract both index and value from the iterable object, use enumerate():

123
nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] for idx, val in enumerate(nums): print(f'{idx}th prime number is: {val}')
copy

Завдання

Given a list of movies in the cinema. Starting with index 0, each element in the array is the name of the movie in production on the i-th day. Transform this data by creating a dictionary schedule that for each movie as key stores the list of days when this movie screenings are. For example:

movies = ['Shrek', 'Snow White', 'Cars', 'Cars', 'Shrek', 'Shrek 2'] =>

Remember about case if movie is not in dict already.

Завдання

Given a list of movies in the cinema. Starting with index 0, each element in the array is the name of the movie in production on the i-th day. Transform this data by creating a dictionary schedule that for each movie as key stores the list of days when this movie screenings are. For example:

movies = ['Shrek', 'Snow White', 'Cars', 'Cars', 'Shrek', 'Shrek 2'] =>

Remember about case if movie is not in dict already.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 3. Розділ 3
toggle bottom row

enumerate()

In case if you need extract both index and value from the iterable object, use enumerate():

123
nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] for idx, val in enumerate(nums): print(f'{idx}th prime number is: {val}')
copy

Завдання

Given a list of movies in the cinema. Starting with index 0, each element in the array is the name of the movie in production on the i-th day. Transform this data by creating a dictionary schedule that for each movie as key stores the list of days when this movie screenings are. For example:

movies = ['Shrek', 'Snow White', 'Cars', 'Cars', 'Shrek', 'Shrek 2'] =>

Remember about case if movie is not in dict already.

Завдання

Given a list of movies in the cinema. Starting with index 0, each element in the array is the name of the movie in production on the i-th day. Transform this data by creating a dictionary schedule that for each movie as key stores the list of days when this movie screenings are. For example:

movies = ['Shrek', 'Snow White', 'Cars', 'Cars', 'Shrek', 'Shrek 2'] =>

Remember about case if movie is not in dict already.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 3. Розділ 3
toggle bottom row

enumerate()

In case if you need extract both index and value from the iterable object, use enumerate():

123
nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] for idx, val in enumerate(nums): print(f'{idx}th prime number is: {val}')
copy

Завдання

Given a list of movies in the cinema. Starting with index 0, each element in the array is the name of the movie in production on the i-th day. Transform this data by creating a dictionary schedule that for each movie as key stores the list of days when this movie screenings are. For example:

movies = ['Shrek', 'Snow White', 'Cars', 'Cars', 'Shrek', 'Shrek 2'] =>

Remember about case if movie is not in dict already.

Завдання

Given a list of movies in the cinema. Starting with index 0, each element in the array is the name of the movie in production on the i-th day. Transform this data by creating a dictionary schedule that for each movie as key stores the list of days when this movie screenings are. For example:

movies = ['Shrek', 'Snow White', 'Cars', 'Cars', 'Shrek', 'Shrek 2'] =>

Remember about case if movie is not in dict already.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

In case if you need extract both index and value from the iterable object, use enumerate():

123
nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] for idx, val in enumerate(nums): print(f'{idx}th prime number is: {val}')
copy

Завдання

Given a list of movies in the cinema. Starting with index 0, each element in the array is the name of the movie in production on the i-th day. Transform this data by creating a dictionary schedule that for each movie as key stores the list of days when this movie screenings are. For example:

movies = ['Shrek', 'Snow White', 'Cars', 'Cars', 'Shrek', 'Shrek 2'] =>

Remember about case if movie is not in dict already.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 3. Розділ 3
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt