Complete the code to get the element at index 2 from the list 'mylist'.
LINDEX mylist [1]The LINDEX command retrieves the element at the specified index. Indexing starts at 0, so index 2 is the third element.
Complete the code to get the last element from the list 'tasks'.
LINDEX tasks [1]Using index -1 with LINDEX returns the last element of the list.
Fix the error in the code to correctly get the first element of the list 'queue'.
LINDEX queue [1]The first element in a Redis list is at index 0. Using any other index will not return the first element.
Fill both blanks to get the element at index 3 from the list 'events' and the element at index -2 from the list 'logs'.
LINDEX events [1] LINDEX logs [2]
Index 3 gets the fourth element from 'events'. Index -2 gets the second last element from 'logs'.
Fill all three blanks to get the first element from 'list1', the last element from 'list2', and the element at index 4 from 'list3'.
LINDEX list1 [1] LINDEX list2 [2] LINDEX list3 [3]
Index 0 gets the first element, -1 gets the last element, and 4 gets the fifth element (indexing starts at 0).