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
1. A four-lane freeway (two lanes in each direction) is located on rolling terrain and has 12-ft lanes, no lateral obstructions
otez555 [7]

Answer:

Maximum number of vehicle = 308

Explanation:

See the attached file for the calculation.

6 0
3 years ago
C. Assuming a fixed-priority scheduling. Consider two tasks to be executed periodically on a single processor, where task 1 has
docker41 [41]

Answer:

hi hello tata byebye nice

8 0
3 years ago
If a worker currently makes $425.00 per week, what Is the gross amount they’ll earn if they work every week of the year
olga nikolaevna [1]

Answer:

we know that

A worker currently makes \$425.00 per week

remember that

1\ year=52\ weeks

so

by proportion find the amount that the worker will earn in one year

\frac{425}{1} \frac{\$}{week} =\frac{x}{52} \frac{\$}{weeks} \\ \\x=52*425 \\ \\x=\$22,100

therefore

the answer is

\$22,100

Explanation:

4 0
3 years ago
Technician A says that carbon monoxide (CO) and hydrocarbon (HC) levels should increase if the air injection reactor (AIR) hoses
lara31 [8.8K]

Answer:Technician A

Explanation:

7 0
3 years ago
Read 2 more answers
Click this link to view O*NET’s Work Activities section for Graphic Designers. Note that common activities are listed toward the
bixtya [17]
I can’t click on the link sorry man
8 0
3 years ago
Read 2 more answers
Other questions:
  • A displacement transducer has the following specifications: Linearity error ± 0.25% reading Drift ± 0.05%/○C reading Sensitivity
    8·1 answer
  • Carbon dioxide flows at a rate of 1.5 ft3 /s from a 3-in. pipe in which the pressure and temperature are 20 psi (gage) and 120 °
    8·1 answer
  • A coin placed 30.8 cm from the center of a rotating, horizontal turntable slips when its speed is 50.8 cm/s.
    12·1 answer
  • Suppose you were a heating engineer and you wished to consider a house as a dynamic system. Without a heater, the average temper
    6·1 answer
  • Yasir is trying to build an energy-efficient wall and deciding what materials to use. How can he calculate the thermal resistanc
    6·1 answer
  • A six-lane divided highway (three lanes in each direction) is on rolling terrain with two access points per mile and has 10- ft
    7·1 answer
  • A rigid tank contains 1 kg of oxygen (O2) at p1 = 35 bar, T1 = 180 K. The gas is cooled until the temperature drops to 150 K. De
    5·1 answer
  • PLLLLLEEESSSEEE IIII NEED ASAP
    12·2 answers
  • The human eye, as well as the light-sensitive chemicals on color photographic film, respond differently to light sources with di
    13·1 answer
  • Which of the following is MOST likely to be true about a service manager?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!