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
sergeinik [125]
3 years ago
13

Write a function, sublist, that takes in a list of numbers as the parameter. In the function, use a while loop to return a subli

st of the input list. The sublist should contain the same values of the original list up until it reaches the number 5 (it should not contain the number 5).
Computers and Technology
1 answer:
Alla [95]3 years ago
4 0

Answer:

Following are the code to this question:

def sublist(l):#defining a method list sublist that accepts a list

   val=[]#defining an empty list

   x=0#defining x variable that store value 0

   while(x<len(l)):#defining loop that check x is lessthen list length  

       if(l[x]==5):#defining if block that checks list value equal to 5

           break#using break keyword  

       val.append(l[x])#add value in val list

       x+= 1#increment the value of x variable by 1

   return val#return val

l=[3,4,7,8,5,3,2]#defining list l

print(sublist(l))#using print method to call sublist method

Output:

[3, 4, 7, 8]

Explanation:

  • In the above python code, a method "sublist" is declared that accepts a list, inside the method an empty list "val" and an integer variable x is defined that stores "0"  value.
  • In the method, a while loop is declared that checks list length and define if block to checklist element value equal to "5". which the condition is true it will return before values.
  • In the last step, a list "l" is declared that holds value and used the print method to call sublist to prints its return value.
You might be interested in
Write a paragraph on the importance of backing up data and mention at least three ways to back up data from your computer.
Scrat [10]

Answer:

Data backup is probably the most important part of any IT system. Backing up your data means periodically saving a copy of your computer’s information to an offsite location for safe keeping. Having a copy of your computer’s data protects it from being lost in the event of a hard drive failure

Explanation:

1-     On a Hard Drive (Onsite Backup)

2-     Online Backup Services (Offsite Backup)

3-     Cloud Backup Services (Offsite Backup)

5 0
4 years ago
Procter &amp; Gamble regularly monitors trends and information posted about their products and brands by consumers on several We
Shkiper50 [21]

Answer:

The correct answer to the following question will be "Web tracking".

Explanation:

This is indeed a business operation to keep an eye on the subscribers or visitors to the business. So what web trackers do is much more than that. They check up on your web activity.

A tracker generally seems to be a database script programmed to extract sets of data on your interests and how you are when you communicate through their database.

There are four types of Web trackers such as:

  • Embedded scripts.
  • Cookies.
  • Finger printers.
  • Supercookies.

3 0
3 years ago
Which disk drive type contains a magnetic HDD with onboard flash memory serving as a non-volatile cache?
Shkiper50 [21]

Answer:

SSHD - Solid State Hybrid Drives

Explanation:

SSHD - Solid State Hybrid Drives -

Hard disk refers to a storage form of device , which uses uses the combination of the fast storage medium like the solid - state drive along with the very higher - capacity hard disk drive .

In the solid state hybrid drives , the combination of the onboard flash memory and the magnetic HDD , which is less expensive than the SSD.

Hence , from the given information of the question ,

The correct term is SSHD - Solid State Hybrid Drives  .

5 0
3 years ago
Describe orderly how to save a Word document into a folder​
ivann1987 [24]
In order to do that you go onto the document you are going to save, on the top left it has the word “file”, click on that, once clicked it should say “Save as” and click on that, it will then ask you where you want it or which folder and you click the folder you want and finally click “save”
7 0
3 years ago
SMART PEOPLE NEEDED
mario62 [17]
D doesn't make much sense, it's valid, but not what we're looking for. B also has a correlation with D, same reasoning applies. As for A, it seems pretty legit, but I don't believe that's what we're looking for.

Choice C is the most obvious one though. We're talking about a network and as may or may not know it's a wireless one in a manner of speaking. A <span>couple of computers in the network that have trouble maintaining a signal will indefinitely lead to failure of a network since both the links and nodes of certain computer systems are incapable of maintaining a signal. </span>
6 0
3 years ago
Other questions:
  • A(n) _______ allows an attacker to use a network structure to send large volumes of packets to a victim.
    5·1 answer
  • PLEASE HELP!!!!!!!!!!!
    7·1 answer
  • A ____ is any manipulation of data, usually with the goal of producing information.
    9·1 answer
  • Arpanet was developed by the united states so that there was a communication network that would survive a nuclear war. True or F
    11·1 answer
  • Like Tess, Brina has a fascinating job! She works as a software engineer with Instagram. She says that Computer Science is a way
    10·2 answers
  • - The concept of communication competence suggests there is no single "ideal" or "effective" way to communicate in every situati
    6·2 answers
  • Write a Java program that will 1. Ask the user to type in a sentence, using a JOptionPane.showInputDialog(). 2. The program will
    10·1 answer
  • What is the difference between a switch and a hub?
    8·1 answer
  • What word describes a violation of copyright laws? What rights do copyright holders have over their work of art
    5·2 answers
  • What is the output of the following C++ code? int list[5] = {0, 5, 10, 15, 20}; int j; for (j = 0; j &lt; 5; j++) cout &lt;&lt;
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!