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
Schach [20]
2 years ago
13

Write the following function that returns True if the list is already sorted in increasing order:

Computers and Technology
1 answer:
miss Akunina [59]2 years ago
4 0

Answer:

# Get input and strip any leading/trailing spaces

inputList = input('Enter list: ').strip()

def issorted(lst):

   if len(lst) < 2:

       return True

   

   current = 1

   prev = 0

   while current < len(lst):

       # Compare if current value is less than the previous one

       if int(lst[current]) < int(lst[prev]):

           return False

       

       prev = current

       current += 1

   

   return True

# Convert input to list

inputList = inputList.split(' ')

# Print output

if issorted(inputList):

   print("The list is already sorted​")

else:

   print("The list is not sorted")

You might be interested in
Which of these standards has the fastest connection?
leonid [27]

Answer:

802.11ac is fastest cinnection

7 0
3 years ago
URGENT HELP PLEASE C+++
gtnhenbr [62]

Answer:

#include using namespace std;

cout << quotient;

Explanation:

not #include ; using namespace std;

; doesn't belong

cout << quotient

forgot the ; at the end

7 0
3 years ago
PLEASE HELP :(
belka [17]

Taking data and instructions from a user, processing the data as per instructions, and displaying or storing the processed data, are the four major functions of a computer. These functions are also known as the input function, process function, output function, and storage function, respectively.

5 0
3 years ago
What is one effective way for employees to keep their skillsets current
iragen [17]
<span> Create a large personal network online</span>
4 0
3 years ago
What feature allows you to access previous copies of a document on OneDrive?
swat32
<span>C) Stored work

I hope this helps :)
</span>
4 0
3 years ago
Read 2 more answers
Other questions:
  • Select all statements that correctly describe the ramifications of important features supported by modern DBMS.
    15·1 answer
  • Which statement best describes a scientific theory?
    13·1 answer
  • 15) the following statement describes government depository librearies , except:
    12·1 answer
  • vulnerability is a feebleness which allows an attacker to condense a system's information assurance to security,is it true or fa
    14·1 answer
  • The function below takes one parameter: a string (date_string) containing a date in the mm/dd/year format. Complete the function
    11·1 answer
  • USDA-APHIS Animal Care Resource Policy #12 "Considerations of Alternatives to Painful/Distressful Procedures" states that when a
    11·1 answer
  • Before becoming romantically involved with a coworker you should
    7·2 answers
  • What are scientists going to explore next on Kepler-186f? A) evidence of the existence of life B) types of plant life that exist
    8·2 answers
  • Explain the computer according to size​
    10·1 answer
  • Heyyyyyy who likes anime​
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!