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
Point: A Point in a two dimensional plane has an integer x coordinate value and an integer y coordinate value.
UNO [17]

Answer:

They are connected

Explanation:

8 0
3 years ago
Given the following code, what is output by the method call, mystery(6 * 8)? public static void mystery (int x[]) { System.out.p
____ [38]

Answer:

B

Explanation:

This question demonstrates the concept of method overloading

Method overloading means having different versions of the same method. In this case the method mystery() has three versions. The compiler is able to determine which method to call by their different parameters

The first implementation of mystery requires an array of integers as parameter

The second implementation requires an int variable

The third implementation requires a String

The Method call mystery(6 * 8) will output B because 6*8 evaluates to an integer which is the expected argument.

7 0
3 years ago
What is e-governence?What are the advantage of it.​
kondaur [170]

Answer:

The advantages of e-government include an improved flow of information from citizen to government, government to citizen, and within government itself. Additionally, e-government helps modernize administration procedures, improving economies and promoting transparency in the process.

E-government is the use of technological communications devices, such as computers and the Internet, to provide public services to citizens and other persons in a country or region.

5 0
3 years ago
The structure and organization of data in a database is called a data ____.
Aleks [24]
Answer:  "hierarchy" .
_____________________________________________________
6 0
3 years ago
When a device or service causes the system to hang during a normal boot, boot into __________ and disable the device or service
Olenka [21]

You should boot into <u>safe mode</u> and disable the device or service when it causes the computer system to hang during a normal boot.

<h3>What is safe mood?</h3>

Safe mood can be defined as a boot option in which the operating system (OS) of a computer system starts in <u>diagnostic mode</u> rather than in a normal operating mode, so as to enable the user correct any problems preventing the computer system to have a normal boot.

This ultimately implies that, safe mood is a diagnostic mode of the operating system (OS) of a computer system that is designed and developed to fix most problems within an operating system (OS) and for the removal of rogue software applications.

Read more on safe mood here: brainly.com/question/13026618

5 0
2 years ago
Other questions:
  • Instructions:Select the correct answer.
    13·1 answer
  • Your browsing the Internet and realize your browser is not responding which of the following will allow you to immediately exit
    14·2 answers
  • A Python function cannot under normal circumstances reference a module variable for its value.
    12·2 answers
  • If Number = 7, what will be displayed after code corresponding to the following pseudocode is run? (In the answer options, new l
    5·1 answer
  • A network administrator wants to logically separate web servers on the network. Which of the following network device will need
    10·2 answers
  • _____ _____ deals with the definitions properties of mathematical models of computation.
    8·1 answer
  • In Modern operating system, the __ feature has dramatically improved user productivity.
    11·1 answer
  • Solve this for brainlest​
    10·1 answer
  • ________ can contain stacked images, text, and other elements which collectively comprise a Photoshop file.
    7·1 answer
  • Can someone give me an earsketch song of summer to turn in
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!