Arianahinton3967 Arianahinton3967
  • 01-08-2020
  • Computers and Technology
contestada

Write a program that extracts the last three items in the list sports and assigns it to the variable last. Make sure to write your code so that it works no matter how many items are in the list

Respuesta :

frknkrtrn
frknkrtrn frknkrtrn
  • 01-08-2020

Answer:

sports = ["football", "basketball", "volleyball", "baseball", "swimming"]

last = sports[-3:]

print(last)

Explanation:

*The code is in Python.

Create a list called sports

Create a variable called last and set it to the last three elements of the sports list using slicing

Print the last

Answer Link

Otras preguntas

I need help ASAP!! Please explain how to solve the problem
3.Complete the text using the words in the box as needed Accept, occasion, and, love, fun, kind, best, party, present, really Dear Ahsan, Thank you very much fo
ghfghfgdsssssssssssssssssssssssfadfqsdf asdwasdasd a
A compound sentence contains two independent clauses joined together with a conjunction. (An independent clause is a word group that can stand on its own as a c
Each piece of DNA called a carries the code for human characteristic. The whole human code contains about sections or
using sets what is the intersection of a=(-2-1,0,1,7) I=(-2,-1,1,2,8)​
PLS HELP ME ON THIS QUESTION I WILL MARK YOU AS BRAINLIEST IF YOU KNOW THE ANSWER!!
Please help. I don't understand anything.
5. Determine the number of square units in the area of the trapezoid whose bases are 3-X units and 10+X units and whose height is 6 units.
15. The height and yolume of a cylinder are 4cm and 616cm respectively. Calculate the diameter of the base. (take t = 27 쪽 A. 7cm B. 154cm C. 14cm D. 64cm​