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 of the following statements are true of software engineers? Check all of the boxes that apply. They are responsible for wr
Zina [86]

Answer:

First two statements: yes. Last two: not so much.

But many of the better ones do have advanced degrees, but some don't.

The laboratory statement is silly; they sit behind a set of screens figuring out stuff and writing code.

4 0
2 years ago
Read 2 more answers
17) you need to locate an article that (1) is published by a university or proffessional association(2) is authored by clearly d
mestny [16]
Scholarly article. [email protected]
3 0
3 years ago
Please Help ASAP. Marking Brainliest For Correct Answer.
mezya [45]

Answer: It is not working because it is missing the code needed to turn right.

Sentence :The robot would move forward two squares and would stay stuck there because it can not move forward nor turn left. You would need to add code for the robot to be able to turn right so that the robot can reach the goal

6 0
2 years ago
What type of user account should Tuan’s brother use?
Sauron [17]

Answer:

d so if he comes back any time soon

Explanation:

6 0
3 years ago
What does choosing Slide Sorter view do?
elixir [45]

Answer:

The last two line i.e "displays miniature versions of all the  presentation's slides​  " is the correct answer to the given question .

Explanation:

The main objective of the slide sorter is showing the miniature versions of all the slides though user can quickly push the slides and organize the slides in well mannered by moving the slides . The Slide Sorter display gave the viewers to thumbnail the overview of the slides.

  • The slide sorter making the presentation effective by organizing and sorting the slide .
  • All the other option are not correct for the  Slide Sorter view that's why these are incorrect option .
3 0
3 years ago
Other questions:
  • When you set the position property for a block element to fixed, the element
    5·1 answer
  • Convert 78 to binary
    6·2 answers
  • Write the definition of a function named fscopy. This function can be safely passed two fstream objects, one opened for reading,
    11·1 answer
  • Which type of loan is based on financial need
    6·1 answer
  • LAB: Plant information (ArrayList) Given a base Plant class and a derived Flower class, complete main() to create an ArrayList c
    6·1 answer
  • To specify your preferred colors, fonts, and effects for a document, which of the following should be done?
    5·2 answers
  • Explain the term game! And give me complete sentences. U can use ur opinion as well!
    11·1 answer
  • Laptop computers use PCMCIA cards, another type of ________
    15·1 answer
  • Microsoft Access is a
    10·1 answer
  • Which file is usually the first file to be displayed when you navigate to a website?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!