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
During a medical evaluation, the doctor can __________.
Elan Coil [88]

Answer:

Treat the patient

i hope this is ur answer

8 0
3 years ago
Cuál de las siguientes es la mejor manera de practicar sus habilidades de tecnología de secundaria?
Mkey [24]
Huh? Do you know English?
8 0
3 years ago
The question belongs to Electrical Engineering (Linear System).
-Dominant- [34]
I’m crying looking at that.
5 0
3 years ago
Assume the work done compressing the He gas is -63 kJ and the internal energy change of the gas is 79 kJ. What is the heat loss
klemol [59]

Answer:

Heat gain of 142 kJ

Explanation:

We can see that job done by compressing the He gas is negative, it means that the sign convention we are going to use is negative for all the work done by the gas and positive for all the job done to the gas. With that being said, the first law of thermodynamics equation will help us to solve this problem.

ΔU = Q + W ⇒ Q = ΔU -W

Q = 79 - (-63) = 142 kJ

Therefore, the gas gained heat by an amount of 142 kJ.

3 0
3 years ago
If you need to write a function that will compute the cost of some candy, where each piece costs 25 cents, which would be an app
masya89 [10]
The best answer would be

D. Int calculateCost(int count);
6 0
3 years ago
Other questions:
  • A lake with constant volume 1.1 x 10^6 m^3 is fed by a stream with a non-conservative pollutant of 2.3 mg/L and flow rate 35 m^3
    14·1 answer
  • Examine a process whereby air at 300 K, 100 kPa is compressed in a piston/cylinder arrangement to 600 kPa. Assume the process is
    11·1 answer
  • he ventilating fan of the bathroom of a building has a volume flow rate of 28 L/s and runs continuously. If the density of air i
    9·1 answer
  • An electric power plant uses solid waste for fuel in the production of electricity. The cost Y in dollars per hour to produce el
    10·1 answer
  • Guys, can you rate this toolbox, please. It is my DT project, made for car trips, what do you think of the idea/design/usability
    12·1 answer
  • What material property would still cause strain in a strain gauge that is positionedperpendicular to the direction of force if i
    6·1 answer
  • Rafel knows that lessons learned is a valuable aid to future projects. When should he and his team address
    14·1 answer
  • Which statement about lean manufacturing is true when you compare it to mass production?
    7·1 answer
  • PLEASE ANSWER THIS DIAL CALIPER
    9·1 answer
  • 1. You should
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!