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
SOVA2 [1]
3 years ago
14

. Write a function called is_sorted that takes a list as a parameter and returns True if the list is sorted in ascending order a

nd False otherwise. Here, I want you to make use of the input function, where users could provide an input that would be the members of the list.

Computers and Technology
1 answer:
aalyn [17]3 years ago
8 0

Answer:

There are multiple ways to solve the given problem, I will be presenting the most simple and easy way of solving this problem in few lines of code.

Python code:

def is_sorted(user_list):

   return user_list == sorted(user_list)

user_list=input("Please enter a list: ")

user_list = user_list.split()

print(is_sorted(user_list))

print("Your list: ", user_list)

Explanation:

A function is_sorted is created which takes a list as input and using the sorted() function of python which returns true when the list is sorted in ascending order and returns false when the list is not sorted in ascending order.

Driver code includes getting input list from the user and using split() function to create a list separated by space then printing the output of is_sorted function and in the last printing the contents of that list.

Output:

Please enter a list: 1 3 6 9

True

Your list:  ['1', '3', '6', '9']

Please enter a list: 15 7  2 20

False

Your list:  ['15', '7', '2', '20']

You might be interested in
What is computer system ?​
Over [174]

Answer:

a system that is a computer

6 0
3 years ago
Read 2 more answers
A _ shows the end of a page . ​
marta [7]

Answer:

page break shows the end of a page.

4 0
3 years ago
Read 2 more answers
Read the following example cover letter:
enot [183]

Answer:

All should be added.

Explanation:

All of these are important to your cover letter to make it seem professional.

Hope this helped

3 0
3 years ago
Read 2 more answers
The view that perceptual processes take place over time and can be thought of in terms of a software/hardware metaphor is known
Wittaler [7]

The view that perpetual processes can be thought of in terms of a software/hardware metaphor is known as the: information processing view.

<h3>What is the Information Processing View?</h3>

Information processing view is explained by the cognitive theory to explain how the brain encodes information and how information are filtered from what we pay attention to in a particular moment. This also determines what is stored in the short-term or in our long-term memory.

Therefore, the view that perpetual processes can be thought of in terms of a software/hardware metaphor is known as the: information processing view.

Learn more about the information processing view on:

brainly.com/question/24863946

3 0
2 years ago
The do-while loop is a __________ loop that is ideal in situations where you always want
belka [17]
your answers are all D
4 0
4 years ago
Other questions:
  • What is the primary criticism against a national identification system based on biometric data?
    13·1 answer
  • Conduct online research to determine specific conflict-resolution and management techniques and skills that would be beneficial
    5·1 answer
  • Label 14 parts of the inside of a computer
    6·1 answer
  • A film camera with only one lens is known as a(n)?
    11·1 answer
  • The marketplace for computer hardware:________ 1. has become increasingly concentrated in top firms 2. has expanded to include a
    5·2 answers
  • Cisco Next Generation Intrusion Prevention System (NGIPS) devices include global correlation capabilities that utilize real-worl
    9·1 answer
  • The fill command try’s to fill or generate content for cells based on a ________.
    15·1 answer
  • is there anybody out there who is a social butterfly like me? If so then you can tlk to me on this. and to anybody out there tha
    12·1 answer
  • Calculate the maximal size of a file if we have:
    6·1 answer
  • Which item is developed last in the cyclical design process
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!