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
A single-cylinder pump feeds a boiler through a delivery
Studentka2010 [4]

Answer:

Net discharge per hour will be 3.5325 m^3/hr

Explanation:

We have given internal diameter d = 25 mm

Time = 1 hour = 3600 sec

So radius r=\frac{d}{2}=\frac{25}{2}=12.5mm=12.5\times 10^{-3}m

We know that area is given by

A=\pi r^2=3.14\times (12.5\times 10^{-3})^2=490.625\times 10^{-6}m^2

We know that discharge is given by Q=AV, here A is area and V is velocity

So Q=AV=490.625\times 10^{-6}\times 2=981.25\times 10^{-6}m^3/sec

So net discharge in 1 hour = 981.25\times 10^{-6}m^3/sec\times 3600=3.5325m^3/hour

8 0
3 years ago
Engineers will redesign their products when they find flaws. TRUE O False​
nataly862011 [7]

Answer:

true

Explanation:

6 0
2 years ago
A punch must cut a hole 30mm diameter in a sheet of steel 2mm thick. The ultimate shear
Anettt [7]

2+2=3

4+5=7

tex]\purple{\rule{45pt}{7pt}}\blue{\rule{45pt}{999999pt}}tex]

7 0
2 years ago
Any unblocked video sights for school ?
jenyasd209 [6]

Answer:

I'm not sure what you mean

Explanation:

8 0
2 years ago
Help me!!
kati45 [8]

Answer:  System Consists Of 1 Kg Of CO2 (Cp = 46.4 J Moll K:') Gas Initially At 1 Bar And 300K. The System Undergo

Explanation:

6 0
2 years ago
Other questions:
  • ¿Por qué creen que la Ingeniería Metalúrgica es una carrera estratégica para el desarrollo de nuestro país?
    9·1 answer
  • What is the linear distance traveled in one revolution of a 36-inch wheel
    6·1 answer
  • After a 65 newton weight has fallen freely from rest a vertical distance of 5.3 meters, the kinetic energy of the weight is
    12·1 answer
  • Is it possible to interface an IC with a different technology such as TTL to HCS12 ports? What are the conditions in terms of el
    10·1 answer
  • A rectangular open box, 25 ft by 10 ft in plan and 12 ft deep weighs 40 tons. Sufficient amount of stones is placed in the box a
    13·1 answer
  • A long corridor has a single light bulb and two doors with light switch at each door.
    15·1 answer
  • Write a program in C++ that can be used by a small theater to sell tickets for performances.The theater’s auditorium has 15 rows
    7·1 answer
  • PLS HELP ME
    14·1 answer
  • An Otto cycle with air as the working fluid has a compression ratio of 8.2. Under cold air standard conditions, what is the ther
    14·1 answer
  • Pleaseeee help me with this!!
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!