Create a list by picking an odd-index items from the first list and even index items from the second using python programming
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Hint:
Use list slicing
Solution:
To access a range of items in a list, use the slicing operator
:
. With this operator, you can specify where to start the slicing, end, and specify the step.For example, the expression
list1[ start : stop : step]
returns the portion of the list from index start to index stop, at a step size step.