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 symbol is at the beginning and end of a multiline comment block? &amp;&amp;&amp; """ %%% ###
yawa3891 [41]

Answer:

#

Explanation:

I have notes on it we learned it in 8th

7 0
3 years ago
Im lonellly whos down to date me
inna [77]

Answer:

I was actually just looking to help with someone's schoolwork. . .

Explanation:

5 0
2 years ago
Read 2 more answers
Write a SELECT statement that joins the Categories table to the Products table and returns these columns: category_name, product
Sphinxa [80]

Answer & Explanation:

1) Query:

SELECT Product_Name, Category_Name, List_Price

FROM Products AS P JOIN Categories AS C

ON C.Category_ID = P.Category_ID

ORDER BY Category_Name, Product_Name ASC;

2) Query:

SELECT C.Last_Name, C.First_Name, Order_Date, P.Product_Name, Item_Price, Discount_Amount, Quantity

FROM Customers AS C JOIN Orders AS O

ON C.Customer_ID = O.Customer_ID

JOIN Order_Items AS OI

ON O.Order_ID = OI.Order_ID

JOIN Products AS P

ON OI.Product_ID = P.Product_ID

ORDER BY Last_Name, Order_Date, Product_Name;

3) Query:

SELECT Category_Name, Product_ID

FROM Categories LEFT JOIN Products

ON Categories.Category_ID = Products.Category_ID

WHERE Product_ID IS NULL;

4) Query:

SELECT 'SHIPPED' AS Ship_Status, Order_Id, Order_Date

FROM Orders

WHERE Ship_Date IS NOT NULL

UNION

SELECT 'NOT SHIPPED' AS Ship_Status, Order_ID, Order_Date

FROM Orders

WHERE Ship_Date IS NULL

ORDER BY Order_Date;

3 0
3 years ago
Distinguish between engineering and architecture​
Liula [17]

difference between engineering and architecture are.

A engineer is a person whose job involves designing and building engines, machines, roads, bridges ,etc .

While architect design buildings only.

3 0
2 years ago
Which of the following is not a true statement? You can import a table or a query directly from an Access database into an Excel
Lilit [14]

Answer:

does anybody know this answer?

Explanation:

no nobody does

5 0
3 years ago
Other questions:
  • Help plz
    5·1 answer
  • Suppose we eliminate tcp and instead rely exclusively on udp as our only transport layer protocol. ⢠how does this impact opera
    15·1 answer
  • What type of social engineering attack uses email to direct you to their their website where they claim you need to update/valid
    6·2 answers
  • 4. Who developed the first design technology program which had a
    12·1 answer
  • DES: Group of answer choices A) is a commonly used symmetric encryption B) algorithm that was developed in the mid-C) 1970s was
    6·1 answer
  • Write two cin statements to get input values into birthMonth and birthYear. Then write a statement to output the month, a dash,
    7·1 answer
  • In client server network, there is no central server //// true or false​
    8·1 answer
  • A Computer Programmer who wants to be surrounded by a large number of like-minded coworkers should take a job with one of the na
    14·2 answers
  • The idea that an object can exist separate from the executing program that creates it is called
    13·1 answer
  • Part of the operating system core is responsible for controlling security, managing the file system, and providing a platform fo
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!