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
bezimeni [28]
2 years ago
6

A list is sorted in ascending order if it is empty or each item except the last one is less than or equal to its successor. HERE

S THE CODE:
def isSorted(input_list):
if len(input_list)==0 or len(input_list)==1:
return True
else:
for i in range(len(input_list)):
for j in range(i, len(input_list)):
if input_list[j] < input_list[i]:
return False
return True

def main():
lyst = []
print(isSorted(lyst))
lyst = [1]
print(isSorted(lyst))
lyst = list(range(10))
print(isSorted(lyst))
lyst[9] = 3
print(isSorted(lyst))


if __name__ == "__main__":
main()
Engineering
1 answer:
Free_Kalibri [48]2 years ago
7 0

Using the knowledge of computational language in python it is possible to write a code that writes a list and defines the arrange.

<h3>Writing code in python:</h3>

<em>def isSorted(lyst):</em>

<em>if len(lyst) >= 0 and len(lyst) < 2:</em>

<em>return True</em>

<em>else:</em>

<em>for i in range(len(lyst)-1):</em>

<em>if lyst[i] > lyst[i+1]:</em>

<em>return False</em>

<em>return True</em>

<em>def main():</em>

<em>lyst = []</em>

<em>print(isSorted(lyst))</em>

<em>lyst = [1]</em>

<em>print(isSorted(lyst))</em>

<em>lyst = list(range(10))</em>

<em>print(isSorted(lyst))</em>

<em>lyst[9] = 3</em>

<em>print(isSorted(lyst))</em>

<em>main()</em>

See more about python at brainly.com/question/18502436

#SPJ1

You might be interested in
Roads in rural areas are _______.
Roman55 [17]

Answer:

Explanation:

Mountain roads often zigzag across a mountain with a series of sharp turns called. switchbacks.

6 0
3 years ago
Read 2 more answers
Which of the following activities will allow an engineer to determine that a building's design is sound?
zhannawk [14.2K]
Please add more details because I don’t know if you are using a book or passage, therefore I cannot help you unless you add more detail
3 0
3 years ago
HELP PLEASE
Sveta_85 [38]

..........23÷357=0.0644257703........

8 0
2 years ago
What is a gearbox ratio
dem82 [27]

Answer:

Divide one teeth count by the other.

Now that you know how many teeth are on each gear, you can find the gear ratio relatively simply. Divide the driven gear teeth by the drive gear teeth. Depending on your assignment, you may write your answer as a decimal, a fraction, or in ratio

Explanation:

5 0
3 years ago
If you've wondered about the flushing of toilets on the upper floors of city skyscrapers, how do you suppose the plumbing is des
Marina86 [1]

Answer:

<em>The plumbing is designed to reduce the impact of pressure forces due to the height of skyscrapers. This is achieves by narrowing down the pipe down to the basement, using pipes with thicker walls down the basement, and allowing vents; to prevent clogging of the pipes.</em>

<em></em>

Explanation:

<em>Pressure increases with depth and density</em>. In skyscrapers, a huge problem arises due to the very tall height of most skyscrapers. Also, sewage slug coming down has an increased density when compared to that of water, and these two factors can't be manipulated. The only option is to manipulate the pipe design. <em>Pipes in skyscrapers are narrowed down with height, to reduce accumulation at the bottom basement before going to the sewage tank. Standard vents are provided along the pipes, to prevent clogging of the pipes, and pipes with thicker walls are used as you go down the basement of the skyscraper, to withstand the pressure of the sewage coming down the pipes.</em>

3 0
3 years ago
Other questions:
  • Consider a system with two tasks, Task1 and Task2. Task1 has a period of 200 ms, and Task2 has a period of 300 ms. All tasks ini
    5·1 answer
  • Five kg of water is contained in a piston-cylinder assembly, initially at 5 bar and 240°C. The water is slowly heated at constan
    5·1 answer
  • Design a digital integrator using the impulse invariance method. Find and give a rough sketch of the amplitude response, and com
    15·1 answer
  • The pressure distribution over a section of a two-dimensional wing at 4 degrees of incidence may be approximated as follows: Upp
    9·1 answer
  • Why would Chris most likely conclude that he should seek help? A. He feels in control of his emotions even though people annoy h
    15·2 answers
  • When would working with machinery be a common type of caught-in and caught-between<br> hazard?
    6·1 answer
  • What does the current in a semi-conductor is produced by?
    15·2 answers
  • What would happen if the brake pedal was released while the bleed screw was open during brake bleeding?
    7·1 answer
  • Which best explains Susan B Anthony purpose in her speech “Women’s rights to the suffrage”
    9·2 answers
  • Which option distinguishes why the behaviors of the team in the following scenario are so important during the engineering desig
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!