Hey there! This problem might be a bit unpredictable, but give it a go and let us know how you do!
You have a list of integers named 'numbers_list' that looks like this: [24, 13, 9, 21, 30, 10, 2, 15]. You want to extract the third element of the list and store it in a variable named 'third_elem'. Then, you want to extract the last three elements of the list and store them in a variable named 'last_three_elem'. Lastly, you want to create a section of the list that includes only the third, fourth and fifth elements, storing it in a variable named 'section'. You have a few lines of code that were reordered. Your task is to reorder the lines of code to meet all the requirements.Extracting specific elements from a list
Report a typo
Reorder lines using drag or arrows. Adjust indentation with left buttons
section = str(numbers_list[2:5])
print("Third element: " + third_elem)
numbers_list = [24, 13, 9, 21, 30, 10, 2, 15]
third_elem = str(numbers_list[2])
print("Last three elements: " + last_three_elem)
print("Section between third and fifth: " + section)
last_three_elem = str(numbers_list[-3:])
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.