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
What is the best way to improve the following code fragment? if ((counter % 10) == 0) { System.out.println("Counter is divisible
Nataly_w [17]

Answer:

The correct code to the given question is

if ((counter % 10) == 0)  // check the condition

{

System.out.println("Counter is divisible by ten: " + counter);  // display

}

else  // check the condition

{

System.out.println("Counter is not divisible by ten: "  +counter); // display the //value

}

counter++; // increment the value of counter

Explanation:

Following are the description of code

  • In the given question we have to check the condition that the given number is divisible by 10 or not .
  • In the if block if the number is divisible by 10 then it print the value of number and increment the value of counter .
  • In the else block if the number is not divisible by 10 then it print the value of number and increment the value of counter .
  • It means the value of counter is increases in the if block as well as in the else block .So we have to remove the counter statement from there and place outside the if and else block .

6 0
3 years ago
When do I use while loops
Marat540 [252]

Answer:

When you dont know how long the loop is going to run for

Explanation:

7 0
3 years ago
For the Address Block 195.200.0.0/16 a. If you have 320 Customers that need 128 addresses/customer - will there be enough addres
Shkiper50 [21]

Answer / Explanation:

195.200.0.0/16

Note: Class C address can not be assigned a subnet mask of /16 because class c address has 24 bits assigned for network part.

2ⁿ = number of subnets

where n is additional bits borrowed from the host portion.

2ˣ - 2 = number of hosts

where x represent bits for the host portion.

Assuming we have 195.200.0.0/25

In the last octet, we have one bit for the network

number of subnets  = 2¹  =2 network addresses  

number of host = 2⁷ - 2= 126 network addresses per subnets

8 0
3 years ago
I will give brainliest!!!!! I NEED HELP ASAP!!!!!!!
klemol [59]

Answer:

I'm pretty sure it's the first answer.

4 0
3 years ago
Select the correct answer.
malfutka [58]

Answer:

D. Distracts the users from core message.

Explanation:

During web development using bright and glaring font colors is often associated with highlighting the key content of the website.

For instance, one can often observe that organisation's logo are presented using bright and glaring font colors or in some other case main key buttons in websites are made attractive using bright colors.

Best example for illustration purpose here is font and colors used by Google for creating Doodle. Google Doodle are always created by using combination of bright and glaring font colors whereas other information on page is presented using light and simple fonts.

Hence the correct option is D.

5 0
4 years ago
Other questions:
  • Apache web server is the most widely used network operating system used on web servers.
    8·2 answers
  • write the structure of an email message ques.2 what do you mean by search engine? write its component .ques. 3 what are the adva
    9·1 answer
  • 5. RAM IS YOUR SYSTEM’S-
    14·2 answers
  • Mack has started with his first photographic assignment for a magazine. He has clicked around thirty images and uploaded them on
    10·1 answer
  • You need to buy a cable to connect a desktop PC to a router. Which cable should
    13·1 answer
  • Theresa is not sure how nondestructive editing can be helpful in her project. Which of these is accurate about nondestructive ed
    8·1 answer
  • - A blacksmith is shoeing a miser's horse. The blacksmith charges ten dollars for his work. The miser refuses to pay. "Very well
    6·1 answer
  • Describe what a Bank Run is.
    10·1 answer
  • What is computer system ?​
    9·2 answers
  • Why do we buy new asset​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!