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
You need to open the negative screw on the ceiling fan,what driver should you use?​
ELEN [110]

Answer:

flat screw driver

because if the screw is negative then you will need a flat screw driver

8 0
3 years ago
You want to select the minimum windows server 2012 edition to support the required roles and hardware. which edition should you
nirvana33 [79]

Edition should you install <u>essentials edition.</u>

<u></u>

<h3>What are the two editions of Windows Server?</h3>

Microsoft has proposed Standard and Datacenter editions of its Windows Server operating systems for several years, which continued with Windows Server 2022.

<h3>What is Windows Server Edition?</h3>

Microsoft Windows Server OS (operating system) is a series of enterprise-class server operating systems created to share services with multiple users and provide extensive managerial control of data storage, applications and corporate networks.

To learn more about Workspace Essentials, refer

brainly.com/question/12578161

#SPJ4

8 0
1 year ago
Data are made anonymous by Destroying all identifiers connected to the data. Requiring all members of the research team to sign
mestny [16]

Answer:

Destroying all identifiers connected to the data.

Explanation:

Identifiers are your virtual location when navigating, if you destroy your 'Virtual ID', nobody could identify you. Also, you could hide your identifiers, in this case, there's a small risk.

3 0
3 years ago
Put the steps in order to produce the output shown below. Assume the indenting will be correct in the program.
FromTheMoon [43]
For numb in [5,8]:
for numa in [2,3]:
print(str(numb) + str(numa))
3 0
2 years ago
What are the main advantages of a solid-state drive (SSD) over a conventional hard disk drive (HDD)? (Choose three)
Masja [62]

Answer:

The benefits of SSDs over HDDs include:

Faster read/write speeds. SSDs can access large files quickly.

Quicker boot times and better performance. Because the drive does not need to spin up as an HDD would, it is more responsive and provides better load performance.

Durability. ...

Power consumption. ...

Quieter. ...

Size.

Explanation:

4 0
2 years ago
Other questions:
  • You have implemented a network where hosts are assigned specific roles, such as for file sharing and printing. Other hosts acces
    7·1 answer
  • Which behavior could be acceptable at a classical concert as well as at a ball game? standing for an exceptional performance che
    9·2 answers
  • You need to perform maintenance on a router and need to temporarily reroute traffic through another office. which would be the b
    6·1 answer
  • 12. In 2009, __________ of all pedestrian fatalities were caused by impaired drivers
    9·2 answers
  • What is the FICO system?
    12·1 answer
  • Write a Java program that generates GUI (Graphical User Interface). Your program should provide labels and textfields to a user
    9·1 answer
  • Sam has created a fashion website. There are many subscribers to his website. He has added new blogs, pictures, and articles abo
    13·1 answer
  • A ___________ variable is used to add up a set of values. fill in the blank
    8·1 answer
  • Why do software managers have to be generalists with a range of skills, rather than simply technical specialists?
    14·1 answer
  • What type of purchase requisition is used to turn-in a recoverable/reparable material to the ssa?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!