1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nuetrik [128]
3 years ago
9

Write a program that extracts the last three items in the list sports and assigns it to the variable last. Make sure to write yo

ur code so that it works no matter how many items are in the list.
Computers and Technology
1 answer:
zhuklara [117]3 years ago
8 0

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]

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
You might be interested in
Why was the movable type of the printing press such a breakthrough for publishing?
guapka [62]
Movable type is not part of a printing press. Before movable type and printing presses, things had to be manually transcribed (copied by hand), which was  extremely expensive. The press mechanized copying, lowering it's cost and driving down the cost of reproduction.

Arguably, there wasn't any publishing before movable type and printing presses.
3 0
3 years ago
Read 2 more answers
¿Qué tipo de información deben proteger los sitios de comercio electrónico?​
Ksivusya [100]
Come Estás How are you
4 0
3 years ago
Read 2 more answers
John just bought a used iPad from a friend who had lost the charging cable. John notices that the cable is like the charging cab
7nadin3 [17]

Answer:

an iphone charger

Explanation:

5 0
4 years ago
To define constructors and member functions outside of a class's original scope, the operator can be used.
Artyom0805 [142]

Answer: Scope resolution operator(::)

Explanation: A member function and the constructor can be called within the function easily but for the execution of the these components outside the class , a special operator is required to call the functions. The scope resolution operator(::) preceding with the name of class is thus used for defining of the function outside class.This operator maintains the cope of the function and constructor outside the class.

8 0
3 years ago
Why am I asked the 4th time to change my email & password?????
dolphi86 [110]
Confirme your email.
3 0
3 years ago
Read 2 more answers
Other questions:
  • Does a soda vending machine Give reciepts?<br><br>need for computer science hw
    7·2 answers
  • Anne-Marie Cole runs the sales division for a local auto insurance firm. One of her key duties is to calculate her company's mar
    13·1 answer
  • What options does the business user have to manually share individual records? A new custom object is being created with a priva
    10·1 answer
  • I REALLY NEED HELP WITH THIS ASSIGNMENT. IT WOULD BE GREATLY APPRECIATED IF SOMEONE HELPED ME. I'M NOT GOOD AT COMPUTER SCIENCE
    6·2 answers
  • It is perhaps not surprising that Etsy was an early adopter of DevOps. It is a relatively small company, with a start-up culture
    7·1 answer
  • The __________ is a center of Internet security expertise and is located at the Software Engineering Institute, a federally fund
    5·2 answers
  • What feature is required to track customer search terms on a website?
    9·1 answer
  • What does playstation network is currently undergoing maintenance?.
    15·1 answer
  • What is the process of ensuring that corporate security policies are carried out<br> consistently?
    6·1 answer
  • Explain briefly how learning how to follow can make a person a good leader
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!