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
3) What kind of bridges direct their load along it's curve and into the
AlladinOne [14]

Explanation:

suspension is the answer

8 0
3 years ago
for high-volume production runs, machining parts from solid material might not be the best choice of manufacturing operations be
Naddik [55]

Answer:

There are actually multiple types of processes a manufacturer uses, and those can be grouped into four main categories: casting and molding, machining, joining, and shearing and forming.

Explanation:

8 0
3 years ago
For the following gear train, if the blue gear is moving at 50 rpm, what are the speeds of the other gears?
Flauer [41]

Answer:

6

Explanation:

6 teddy bears

5 0
3 years ago
Applications of fleming hand rule
Eva8 [605]

Answer:

Fleming hand rule represents the direction of current in a generator's windings and induced current as a conductor is attached to a circuit such that it moves in a magnetic field.

Explanation:

Fleming hand rule represents the direction of current in a generator's windings and induced current as a conductor is attached to a circuit such that it moves in a magnetic field.

Fleming hand rule is used in the case of electric motors and electric generators.

Fleming hand rule is used to determine the following:

1. Direction of torque

2. Angular velocity

3. Angular acceleration

4 0
3 years ago
A 35 ft long solid steel rod is subjected to a load of 8,000 lb. This load causes the rod to stretch 0.266 in. The modulus of el
solong [7]

Answer:

53.67

Explanation:

3 0
3 years ago
Other questions:
  • How much work does the electric field do in moving a proton from a point with a potential of +V1 = +185 V to a point where it is
    15·1 answer
  • After a capacitor is fully chargerd, a small amount of current will flow though it. what is this current called?
    14·1 answer
  • 5) Two concentric spheres of diameter D1= 70 cm and D2= 120 cm are separated by an air space and have surface temperatures of T1
    13·1 answer
  • Which of the following drivers has the right-of-way?
    9·1 answer
  • Some connecting rods have ____ to help lubricate the cylinder wall or piston pin.
    12·2 answers
  • What's the best way to plan an organized​
    7·1 answer
  • Determine the force in members FD and DB of the frame. Also, find the horizontal and vertical components of reaction the pin at
    15·1 answer
  • The Aluminum Electrical Conductor Handbook lists a dc resistance of 0.01558 ohm per 1000 ft at 208C and a 60-Hz resistance of 0.
    11·1 answer
  • Need help coding this i’m using python.
    11·1 answer
  • What is shown in the above figure
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!