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
dmitriy555 [2]
3 years ago
8

Write a program that takes a list of integers as input. The input begins with an integer indicating the number of integers that

follow. You can safely assume that the number of integers entered is always less than or equal to 10. The program then determines whether these integers are sorted in the ascending order (i.e., from the smallest to the largest). If these integers are sorted in the ascending order, the program will output Sorted; otherwise, it will output Unsorted
Computers and Technology
1 answer:
Naya [18.7K]3 years ago
4 0

Answer:

is_sorted = True

sequence = input("")

data = sequence.split()

count = int(data[0])

for i in range(1, count):

   if int(data[i]) >= int(data[i+1]):

       is_sorted = False

       break

if is_sorted:

   print("Sorted")

else:

   print("Unsorted")

Explanation:

*The code is in Python.

Initialize a variable named is_sorted as True. This variable will be used as a flag if the values are not sorted

Ask the user to enter the input (Since it is not stated, I assumed the values will be entered in one line each having a space between)

Split the input using split method

Since the first indicates the number of integers, set it as count (Note that I converted the value to an int)

Create a for loop. Inside the loop, check if the current value is greater than or equal to the next value, update the is_sorted as False because this implies the values are not sorted (Note that again, I converted the values to an int). Also, stop the loop using break

When the loop is done, check the is_sorted. If it is True, print "Sorted". Otherwise, print "Unsorted"

You might be interested in
Which devices typically generate computer output ?
Andrews [41]
Monitor , printer , speaker , projector , keyboard etc
6 0
3 years ago
Read 2 more answers
Purpose: This application provides experience with user input and interaction in the Console, writing files to disk, working wit
pishuonlain [190]

Answer:

the answer is c#/.net

Explanation:

5 0
3 years ago
E-governance is the only solution against corruption. justify the statement in context of nepal​
notka56 [123]

Answer:

Following are the solution to this question:

Explanation:

The E-government implies use as part of the government systems to offer SMART, which is used to manage smart governance, ethics or accountability, sensitivity, and transparency. It is the research teams, that also shown that policies were progressing in India's creation of information technology. It is also argued against reducing the risk of bribery through improved public official surveillance and reducing its need for citizen engagement with porters with key services.

6 0
3 years ago
What is an example of the most important role of a systems analyst in any corporation?
dsp73

Answer: The system analyst is one of the most important members in any organisation. These system analyst has to analyse different data of the organisation which would help to bring out the different any new business policy changes or any kind of improvement.

Explanation:

An example to know this better would be the system analyst of a telecom company. Here the role of the system analyst would be bring out the design and implementation of new telecom information system and also should be aware of previous data of the organization. The system analyst would also be responsible to bring out the new business policies based on latest telecom standards and ensure the systems conforms to the latest standards.

5 0
3 years ago
Software that people commonly use in the workplace to make their lives easier is called?
emmasim [6.3K]
Answer: System Software

7 0
3 years ago
Other questions:
  • Plagiarism occurs when writers
    14·2 answers
  • Entering the formula =SUM(C5:C18) in cell C19 will result in which of the following?
    10·1 answer
  • Although you can use a dialog box to indent paragraphs, word provides a quicker way through the ____.
    7·1 answer
  • With arbitrary code execution, the ________________ launches ("spawns") a command shell from which instructions can then be issu
    11·1 answer
  • Do the shape of a sign gives you a clue about the information contained on the sign
    7·1 answer
  • The Status bar is used to control the majority of the drafting settings in AutoCAD
    13·1 answer
  • . Explain and demonstrate the functionality of timer devices in an embedded system[
    9·1 answer
  • A list of sources used for in-text citations that appears at the end of a document is called:
    10·1 answer
  • Which button in the Sort & Filter gallery of the Data tab would alphabetize from A to Z quickly?
    6·2 answers
  • Arrange the Jumbled letters 1.eilf ngrihsa ________________ 2.cersityu ourreecs ________________ 3. ngrihsa ________________ 4.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!