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
Write a simple JavaScript function named makeFullName with two parameters named givenName and familyName. The function should re
Kazeer [188]

Answer:

Explanation:

Ji

3 0
2 years ago
A competitor goes to your public website and discovers that they can get into a directory that you did not know could be reached
Ivan

Answer:

Yes, directory traversal attack.

Explanation:

A website is a collection big web pages hosted on a web server. It contains contents like links and sometimes directory root paths. This a vulnerability attacks an exploit to access the information in a database.

There are two access to a database. One is the authentication process issued for authorised user access and the other is the root access only accessible to the network administrator. It contains paths to directories in the servers.

A directory traversal attack or path attack is done through a web browser by an attacker, who seeks for a weak path link on the public's website and accesses the information in the server.

5 0
3 years ago
Write a program that display your name c++
storchak [24]

Answer:

#include <iostream>

#include <string>

int main() {

std::string name;

std::cout << "Please enter a name: ";

std::cin >> name;

std::cout << "Hello " << name<<"!";

}

Explanation:

Asks for your name and adds Hello {name}!

8 0
3 years ago
What is one way the Design tab in the PowerPoint Online application is used?
Vikentia [17]
The transition slides
6 0
3 years ago
Read 2 more answers
As we think of computer crime, there are ways in which thieves can steal your banking information through ATM machines. If you w
Travka [436]

Answer:NO, I WILL NOT GIVE THE TELEPHONE NUMBER

WHY?

IT IS A BREACH OF TRUST

IT IS A BREACH OF DATA PRIVACY

IT ALSO VIOLATES THE PRIVACY OF INFORMATION RIGHT OF THE GIRL.

Explanation:BREACH OF TRUST is act or actions taken against the signed agreement between a person and another party which may be any Organisation like a Financial Institution where the Financial Institution agrees not to release the personal Information about their customer without the person's consent.

IT IS A BREACH OF DATA PRIVACY many persons wants their data which are made available to Organisation to be kept private,divulging such information without the person's consent is a reach of data privacy.

It violates the privacy of Information right of the Girl, except for Security or other specified reasons no Organisations or person is given the right to divulge another person's right to a third party, ALL THESE VIOLATIONS ARE PUNISHABLE UNDER THE LAWS OF THE LAND.

4 0
3 years ago
Other questions:
  • Half of the integers stored in the array data are positive, and half are negative. Determine the
    15·1 answer
  • How many valence electrons are present in the atom of the atomic number of 12?
    10·1 answer
  • ​ In addition to analyzing logic and program code, a project team usually holds a session with users, called a _____, to review
    5·1 answer
  • List the correct order of steps necessary to using usmt to migrate files from an old computer to a new computer.
    5·1 answer
  • The part of the eye thats similar to the film of a camera is the
    7·1 answer
  • I need help, thank you
    12·1 answer
  • Plsss help me<br>give two examples of problems that can occur when sytems do not work properly​
    9·1 answer
  • Two girls were born to the same mother, on the same day, at the same time, in the same month and the same year and yet they're n
    7·1 answer
  • Which strategies for effective presentations is Ian using in his opening? Check all that apply.
    8·2 answers
  • How will I go about conducting the investigation on fake news
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!