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]
4 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]4 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
The __________ level focuses on developing the ability and vision to perform complex, multidisciplinary activities and the skill
Alex73 [517]

Answer:

Education and experience

Explanation:The Education and experience level of a particular person is a major determinant factor in Information technology.

An Information Security professional is a person who has adequate knowledge and capabilities to implement strategies, systems and techniques in place in order to achieve safety in the use of information technology. Most organisations make the Education and experience of the professional to be of interest when recruiting for an IT position.

6 0
3 years ago
What is the purpose of anti-bullying laws
nasty-shy [4]
The purpose of anti-bullying laws is so that people aren’t getting bullied because when someone gets bullied it could cause them to become depressed and not happy on who they are
6 0
3 years ago
Read 2 more answers
If you don’t have a paper copy of the FAFSA form, how else can you fill it out?
Ronch [10]
Go on your school computer, and find a copy of the form. Then print it from the school printer.
3 0
3 years ago
Read 2 more answers
Which ribbon tab is not a default in Outlook 2016's main interface?
Verizon [17]

Answer:

review

Explanation:

4 0
3 years ago
Read 2 more answers
What displays the columns dialog box?
kkurt [141]

More Columns Command displays the Column Dialog Box.  Our column choices aren't limited only to the drop-down menu. Select More Columns at the bottom of the menu so as  to access the Columns dialog box.

3 0
3 years ago
Other questions:
  • Which of the following software is cloud-based? OpenOffice Writer Word 2013 Word Online Word Perfect\
    13·2 answers
  • Customer A with a Bronze service level package calls in a Critical System Failure at 9:00 AM. Customer B with a Silver service l
    15·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
  • What is a googleplex?
    7·1 answer
  • What port is typically reserved and utilized by the Secure Hypertext Transfer Protocol to create a secure connection to a Web se
    13·1 answer
  • a hacker who plants a rogue wireless access point on a network in order to sniff the traffic on the wired network from outside t
    12·1 answer
  • HELLO. A computer can only understand the numbers 1 and 2.<br><br> TRUE OR FALSE
    9·1 answer
  • This is computer and programming
    15·2 answers
  • Can you distinguish between the following examples and determine which one is NOT creative work? a. software b. slogan c. screen
    15·1 answer
  • Consider Parameters with Referencing Environment. One complication with parameters that are subprograms appears only with langua
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!