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
Assume passwords are selected from four character combinations of 26 lower case alphabetic characters. Assume an adversary is ab
finlep [7]

Answer:

Given:

Passwords are selected from 4 characters.

Character combinations are 26 lower case alphabetic characters.

Passwords attempts by adversary is at rate of 1 second.

To find:

Expected time to discover the correct password

Explanation:

Solution:

4 character combinations of 26 alphabetic characters at the rate of one attempt at every 1 second = 26 * 4 = 104

So 104 seconds is the time to discover the correct password. However this is the worst case scenario when adversary has to go through every possible combination. An average time or expected time to discover the correct password is:

13 * 4 = 52

You can also write it as 104 / 2 = 52 to discover the correct password. This is when at least half of the password attempts seem to be correct.

3 0
3 years ago
1. What is the global marketplace?
VladimirAG [237]

I know the answer for 1 is A

5 0
4 years ago
Read 2 more answers
How can I, fill the application form for jobs. [such as Macdonal's jobs].?
pochemuha
I don’t really understand what this question is asking 100%, but you can either walk into the McDonald’s you want to work at and ask for an application. They might give it to you, but will most likely tell you to apply online.

If they do tell you to apply online, go to the McDonald’s website and scroll all the way down to the bottom.

There are sections you can choose such as: About Us, Careers, Services, Community, and Contact Us.

Clearly you want to go to Careers.

Under Careers are: Education Opportunities, Employee Perks, Meet Our People, Working With Us, and Apply Now.

Click Apply Now and start your application.

5 0
3 years ago
How can we get the number of records or rows in a table using MySQL? *
luda_lava [24]

The number of records or rows in a table using MySQL can be got by using the COUNT statement.

Explanation:

  • To counts all of the rows in a table, whether they contain NULL values or not, use COUNT
  • That form of the COUNT() function basically returns the number of rows in a result set returned by a SELECT statement
  • The SQL COUNT() function returns the number of rows in a table satisfying the criteria specified in the WHERE clause.
  • It sets the number of rows or non NULL column values.
  • COUNT() returns 0 if there were no matching rows.
  • The SQL COUNT function is an aggregate function that returns the number of rows returned by a query. You can use the COUNT function in the SELECT statement to get the number of employees, the number of employees in each department, the number of employees who hold a specific job, etc.
3 0
3 years ago
A __________ is a combination of software and hardware that links two different types of networks.
timurjin [86]
A computer system is a combination of software and hardware that links two different types of networks
5 0
3 years ago
Other questions:
  • Give the Division Hashing function and the index it maps the key 2000 into, assuming a primary storage area array size of 61 ele
    6·1 answer
  • 1.2 Discuss each of the following terms: (a) data (b) database (c) database management system (d) database application program (
    12·1 answer
  • Which of the following is an upper body workout
    6·2 answers
  • Which option will you use to expose your presentation to the audience
    11·2 answers
  • c++ Project 6: Buoyancy. Buoyancy is the ability of an object to float. Archimedes’ principle states that the buoyant force is e
    13·1 answer
  • Advantages of desktop publishing over traditional methods include       
    11·1 answer
  • The data-mining technique that creates a report or visual representation is _____.
    13·1 answer
  • Find different between manocots and dicots clarify with example​
    14·1 answer
  • Explain the importance of technology in at least 100 words
    11·1 answer
  • Match the roles to the task they perform.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!