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
What are three ways digital identity is created and kept up? (open answer)
Anna007 [38]

Answer:

Capture attributes as ID documents or biometric data

Explanation:

Examples of such attributes include biometrics, verified identification documents, and third-party verification procedures. To create a trusted digital ID, there are typically three steps: capturing verified attributes, verification of the documents, and digitization of the ID.

Great day :) toodles

6 0
2 years ago
The web lab consists of which elements. Select all that apply. Group of answer choices Files Inspector Tool Preview Hints Work S
djverab [1.8K]

Answer:

Inspector Tool

Preview

Work Space

Instructions

Explanation:

Web Lab is a function that incorporates HTML in web development. It has functions such as Workspace where the developer writes the body of the website. Preview helps the developer take a look at the final product of what he is creating. Instructions panel provides a list of the different types of html packages that the developer can chose from.

All of these options help the developer produce a website that is up to standard.

8 0
2 years ago
5 características de la obsolescencia programada...
snow_lady [41]

Answer:

Obsolescencia programada es cuando un producto está diseñado deliberadamente para tener un tiempo de vida específico. ... Los productos dejan de funcionar al cabo de un tiempo, no porque estén estropeados, sino por que han sido diseñados para fallar al cabo de ese periodo.

Explanation:

espero y esto te pueda ayudar

4 0
3 years ago
Which type of electronic payment is typically favored in b2b?
Dennis_Churaev [7]
Electronic checks would<span> typically be favored in b2b</span>
4 0
2 years ago
By applying styles,____ formats are being applied each time?
Ray Of Light [21]
(A) the same, by applying styles the same formats are being applied each time.
8 0
3 years ago
Other questions:
  • Is backing up computer files done on the hard drive?
    5·1 answer
  • Write a Python function that will accept as input three string values from a user. The method will return to the user a concaten
    8·1 answer
  • 2) [13 points] You’ve been hired by Banker Bisons to write a C++ console application that determines the number of months to rep
    8·1 answer
  • Look at the following program and answer the question that follows it. 1 // This program displays my gross wages. 2 // I worked
    8·1 answer
  • A group of users is unable to connect to the network. When testing several of the PCs and issuing the command ipconfig, the tech
    10·1 answer
  • 3. Discuss microprocessor components, chips,
    15·1 answer
  • If I got a monitor and kept my garbage laptop could I play games on max graphics?
    13·1 answer
  • Helpppppp me please cuz its due rn. put the correct word in the correct spot
    14·1 answer
  • Olivia wants to change some settings in Outlook. What are the steps she will use to get to that function? open Outlook → File →
    7·2 answers
  • 1. (A) What do you mean by computer? Discuss the use of<br> computer in daily life.
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!