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
Two streams of air enter a control volume: stream 1 enters at a rate of 0.05 kg / s at 300 kPa and 380 K, while stream 2 enters
alex41 [277]

Answer:

0.08kg/s

Explanation:

For this problem you must use 2 equations, the first is the continuity equation that indicates that all the mass flows that enter is equal to those that leave the system, there you have the first equation.

The second equation is obtained using the first law of thermodynamics that indicates that all the energies that enter a system are the same that come out, you must take into account the heat flows, work and mass flows of each state, as well as their enthalpies found with the temperature.

 

finally you use the two previous equations to make a system and find the mass flows

I attached procedure

5 0
3 years ago
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
The sum ofall microscopic forms of energy of a system is quantified as flow energy. a)True b) False
Sliva [168]

Answer: b) False

Explanation: Microscopic energy is the the energy that is based on the  molecular level in a particular energy system. Microscopic energy basically comprise with tiny particles like atoms and molecules .The sum of all microscopic form of energy e together make the internal energy .Therefore, the statement given is false because the sum of all the microscopic forms of energy of a system is quantified as internal energy not flow energy.

3 0
4 years ago
How does a rudder help maneuver an airplane?
Nonamiya [84]
It’s just helps it like
4 0
3 years ago
A study of online dating found that when including emoticons in their profiles, response rates for female users _______ by _____
Dvinal [7]

Answer:

Increased, 5%

Explanation:

Recent studies conducted on online dating sites established that the response of female users increased by 5% when emotions are in their profiles even as for male users' response also increased by 8%. Another study also revealed that those who have never used online dating sites and/or mobile dating apps believe that people who use dating apps are desperate.

8 0
3 years ago
Other questions:
  • Which of the following is likely to have the suffix "" after the domain name in its URL?
    7·2 answers
  • Ammonia enters an adiabatic compressor operating at steady state as saturated vapor at 300 kPa and exits at 1400 kPa, 140◦C. Kin
    11·1 answer
  • Thermosetting polymers are polymers that becomes soft and pliable when heated. ( True , False )
    8·2 answers
  • Heat in the amount of 100 kJ is transferred directly from a hot reservoir at 1200 K to a cold reservoir at 600 K. Calculate the
    15·1 answer
  • Automobile engines normally have
    8·1 answer
  • Which one is dependent variable?
    13·1 answer
  • The input and output signals of a system is related by the following equation: fraction numerator d squared y over denominator d
    11·1 answer
  • Air is compressed in a well insulated compressor from 95 kPa and 27 C to 600 kPa and 277 C. Use the air tables; assume negligibl
    11·1 answer
  • Thoughts on Anime?<br> Whats your fav
    10·2 answers
  • 100000000000x1000000000000=?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!