Answer:
Following is the program in python programming language
sports = [14, 25, 32, 63, 79, 38, -10] #list sports
print("The original list is : " + str(sports)) #display original list
last = sports[-3:] #extracts the last 3 items from the list
print("The last 3 elements of list is : " + str(last)) #display the last 3 item
Output:
The original list is : [14, 25, 32, 63, 79, 38, -10]
The last 3 elements of list is: [79, 38, -10]
Step-by-step explanation:
Following are the description of program
- Declared and initialized the items in the list "sports".
- After that display the list "sports" by using str function in the python language
- sports[-3: this will extract the last 3 three items in the list and store the result in the last variable .
- Finally display the last variable it will print the last 3 element in the list