课程: Level Up: Python
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Find all list items
(game reward effects) - Python's index method finds the index of the first item in a list. But what if there are multiple instances of that item? Your goal for this challenge is to write a Python function to find the indices for all items in a list that are equal to a given value. It should accept two input parameters; the list to search, and the value you're searching for. The output should be a list of indices each represented by a list of numbers. Keep in mind that Python lists can also contain other lists, so your function should be able to traverse multidimensional lists to find all indices of the given value. For example, if I wanted to find all of the twos in this list, which contains several sublists, passing it to my index_all function should find this first one, which is nested three lists deep and can be indexed at 0, 0, 1. This next two, which is only two lists deep and can be indexed at 0, 1, and the third…
内容
-
-
-
Find prime factors3 分钟 11 秒
-
(已锁定)
Identify a palindrome2 分钟 48 秒
-
(已锁定)
Sort a string3 分钟 2 秒
-
(已锁定)
Find all list items3 分钟 12 秒
-
(已锁定)
Play the waiting game2 分钟 22 秒
-
(已锁定)
Save a dictionary3 分钟 13 秒
-
(已锁定)
Schedule a function3 分钟 16 秒
-
(已锁定)
Send an email3 分钟 12 秒
-
(已锁定)
Simulate dice3 分钟 16 秒
-
(已锁定)
Count unique words3 分钟 12 秒
-
(已锁定)
Generate a password3 分钟 59 秒
-
(已锁定)
Merge CSV files3 分钟 35 秒
-
(已锁定)
Solve a sudoku4 分钟 8 秒
-
(已锁定)
Build a zip archive3 分钟 42 秒
-
(已锁定)
Download sequential files4 分钟 2 秒
-