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
Schach [20]
2 years ago
13

Write the following function that returns True if the list is already sorted in increasing order:

Computers and Technology
1 answer:
miss Akunina [59]2 years ago
4 0

Answer:

# Get input and strip any leading/trailing spaces

inputList = input('Enter list: ').strip()

def issorted(lst):

   if len(lst) < 2:

       return True

   

   current = 1

   prev = 0

   while current < len(lst):

       # Compare if current value is less than the previous one

       if int(lst[current]) < int(lst[prev]):

           return False

       

       prev = current

       current += 1

   

   return True

# Convert input to list

inputList = inputList.split(' ')

# Print output

if issorted(inputList):

   print("The list is already sorted​")

else:

   print("The list is not sorted")

You might be interested in
A _______ attack is where the input includes code that is then executed by the attacked system.
sweet [91]

Answer: Code injection

Explanation:

3 0
2 years ago
Which of the following is not a danger of blogging
Ainat [17]
D. staying connected with an old friend.

4 0
3 years ago
Read 2 more answers
Justify the need for branching and jump codes in the instruction set using real world scenarios
topjm [15]

Answer:

As in the real world, people using a program would provide different inputs, that would require different outputs. For example in a traffic light system, there could be a function that constantly checks for if the button is pressed. When the button is pressed the traffic light loop would branch out of its current running code in order to turn the lights to red, and allow the pedestrians to cross.

8 0
3 years ago
a mobile base in an urban environment has the power of 15 microW at 175 m. If the propagation follows an inverse cube power law,
Evgen [1.6K]

Answer: Power P at distance 0.7 km is: 0.234 µW

Explanation:

We know that

inverse cube-power law.

Thus Power, P = c / d³

Substituting we have

15 µW = c / (175 m)³

c = (15 µW) x (175 m)³

Then finally Power value at 0.7 km.

Will be

P = c / d³

P = ((15 µW) x (175 m)³) / (700 m)³

= (15 µW) x (175 / 700)³

= (15 µW) x (0.25)³

=(15 µW) x (0.015625)

P = 0.234 µW

8 0
4 years ago
Change the file name for index.html to index.php
Damm [24]

The PHP code is given below:

<h3>PHP code</h3>

if(isset($_REQUEST['login_btn'])){

       $email = filter_var(strtolower($_REQUEST['email']),FILTER_SANITIZE_EMAIL); //strtolower changes email to all lower case

       $password = strip_tags($_REQUEST['password']);

The remaining code is in the file attached.

 

Read more about PHP here:

brainly.com/question/27750672

#SPJ1

Download txt
4 0
2 years ago
Other questions:
  • Write a copy assignment operator for CarCounter that assigns objToCopy.carCount to the new objects's carCount, then returns *thi
    7·1 answer
  • Find every number from 1 to n (inclusive) that is a palindrome which starts with the digit 3. Do not user a helper function.
    10·1 answer
  • Local variables:A. Lose the values stored in them between calls to the method in which the variable is declared
    8·1 answer
  • A(n ________ is information that is passed to a function, and a(n ________ is information that is received by a function.
    15·1 answer
  • Susan teaches many individuals and business professionals how, why, and the benefits and challenges to using social media. Of th
    15·1 answer
  • Low-end CRM systems are designed for companies like Boeing because they only have a few, large customers.
    11·1 answer
  • Which of the following contains hardware systems similar to the affected organization but does not host live data?
    13·1 answer
  • Ryan is working on the layout of his web page. He needs to figure out where the title, links, text, and images should go. Which
    13·2 answers
  • What are the missing letters _A_TO_ ( 6 letters) a type of computer.
    13·2 answers
  • Irma bought a gaming computer at Bestbuy 3 years ago and it’s been on ever since. Her computer is staring to feel unstable and a
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!