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
bezimeni [28]
2 years ago
6

A list is sorted in ascending order if it is empty or each item except the last one is less than or equal to its successor. HERE

S THE CODE:
def isSorted(input_list):
if len(input_list)==0 or len(input_list)==1:
return True
else:
for i in range(len(input_list)):
for j in range(i, len(input_list)):
if input_list[j] < input_list[i]:
return False
return True

def main():
lyst = []
print(isSorted(lyst))
lyst = [1]
print(isSorted(lyst))
lyst = list(range(10))
print(isSorted(lyst))
lyst[9] = 3
print(isSorted(lyst))


if __name__ == "__main__":
main()
Engineering
1 answer:
Free_Kalibri [48]2 years ago
7 0

Using the knowledge of computational language in python it is possible to write a code that writes a list and defines the arrange.

<h3>Writing code in python:</h3>

<em>def isSorted(lyst):</em>

<em>if len(lyst) >= 0 and len(lyst) < 2:</em>

<em>return True</em>

<em>else:</em>

<em>for i in range(len(lyst)-1):</em>

<em>if lyst[i] > lyst[i+1]:</em>

<em>return False</em>

<em>return True</em>

<em>def main():</em>

<em>lyst = []</em>

<em>print(isSorted(lyst))</em>

<em>lyst = [1]</em>

<em>print(isSorted(lyst))</em>

<em>lyst = list(range(10))</em>

<em>print(isSorted(lyst))</em>

<em>lyst[9] = 3</em>

<em>print(isSorted(lyst))</em>

<em>main()</em>

See more about python at brainly.com/question/18502436

#SPJ1

You might be interested in
For the system in problem 4, suppose a main memory access requires 30ns, the page fault rate is .01%, it costs 12ms to access a
raketka [301]

Answer:

a. 7.75

b. 24.4

Explanation:

The Operating system uses virtual memory and page tables maps these virtual address to physical address. TLB works as a cache for such mapping.

program >>> TLB >>> cache >>> Ram

A program search for a page in TLB, if it doesn't find that page it's a TLB miss and then further looks for the page in cache.

If the page is not in cache then it's a cache miss and further looks for the page in RAM.

If the page is not in RAM, then it's a page fault and program look for the data in secondary storage.

So, typical flow would be

Page Requested >> TLB miss >> cache miss >>main memory>> page fault >> looks in secondary memory.

Here,

Main memory access time= 30 ns

Page fault rate=.01%

page fault service time= 12ns

TLB access time=7 ns

TLB hit rate= .95%

TLB miss rate =1-.95=.05%

cache access time = 15 ns

cache miss rate= .3%

cache hit rate = 1-.3=.97%

So,

a) TLB hit time= TLB access time = 7 ns

cache hit time = TLB hit rate * TLB access time + TLB miss rate * ( TLB access time + cache hit time)

= .95 * 7 + .05 * (7+15)

= 7.75 ns

b) EAT for TLB hit= 7ns

Total EAT = TLB hit rate *( TLB access time + Cache hit rate * cache access time + cache miss rate * (cache + main memory access time))+ TLB miss rate ( TLB access time + main memory access time + cache hit rate * cache access time + cache miss rate ( cache + main memory access time))

= .95 *( 7 + (.97*15) + .03(15+30))+ .05*(7+30+(.97*15) + .03 ( 15 + 30))=24.4 ns

8 0
3 years ago
A heating torch is usually referred to as what?<br><br> Stick<br> Flower<br> Rose-bud<br> Lighter
Aleonysh [2.5K]
I would select rose-bud.
3 0
3 years ago
Read 2 more answers
What does WCS stand for? A. Western CAD System B. Worldwide Coordinate Sectors C. World Coordinate System D. Wrong CAD Settings
Ray Of Light [21]

Answer:

The correct answer is C. World Coordinate System

Explanation:

The World Coordinate System has to do with that coordinate system which is fixed in the activities of the CADing. There is a default system in which we can refer to them as soon as we want to manipulate the objects and add new elements.

7 0
3 years ago
A room is kept at −5°C by a vapor-compression refrigeration cycle with R-134a as the refrigerant. Heat is rejected to cooling wa
Fed [463]

Answer:

note:

<u>solution is attached in word form due to error in mathematical equation. furthermore i also attach Screenshot of solution in word due to different version of MS Office please find the attachment</u>

Download docx
4 0
3 years ago
Read 2 more answers
A three-point bending test was performed on an aluminum oxide specimen having a circular cross section of radius 5.6 mm; the spe
ankoles [38]

Answer:

F =  8849 N

Explanation:

Given:

Load at a given point = F =  4250 N

Support span = L = 44 mm

Radius = R = 5.6 mm

length thickness of tested material = 12 mm

First compute the flexural strength for circular cross section using the formula below:

σ_{fs} = F_{f} L / \pi  R^{3}

σ = FL / π R³

Putting the given values in the above formula:

σ = 4250 ( 44 x 10⁻³ ) / π  ( 5.6 x 10⁻³ ) ³

  = 4250 ( 44 x 10⁻³ )  / 3.141593 ( 5.6 x 10⁻³ ) ³

  = 4250 (44 x 1 /1000 )) / 3.141593 ( 5.6 x 10⁻³ ) ³

  = 4250 ( 11 / 250  ) / 3.141593 ( 5.6 x 10⁻³ ) ³

  = 187 / 3.141593 ( 5.6 x 1 / 1000 ) ³

  = 187 / 3.141593 (0.0056)³

  = 338943767.745358

  = 338.943768 x 10⁶

σ = 338 x 10⁶ N/m²

Now we compute the load i.e. F from the following formula:

F_{f} = 2 σ_{fs} d³/3 L

F = 2σd³/3L

  = 2(338 x 10⁶)(12 x 10⁻³)³ / 3(44 x 10⁻³)

  = 2 ( 338 x 1000000 ) ( 12 x 10⁻³)³ / 3 ( 44 x 10⁻³)

  = 2 ( 338000000 ) ( 12 x 10⁻³)³ / 3 ( 44 x 10⁻³)

  = 676000000 ( 12 x 10⁻³)³ / 3 ( 44 x 10⁻³)

  = 676000000 ( 12  x  1/1000  )³ / 3 ( 44 x 10⁻³)

  = 676000000 (  3  / 250  )³ / 3 ( 44 x 10⁻³)

  = 676000000 (  27  / 15625000 )  / 3 ( 44 x 10⁻³)

  = 146016  / 125 / 3 ( 44 x 1 / 1000  )

  = ( 146016  / 125 ) /  (3 ( 11 /  250 ))

  =  97344  / 11

F =  8849 N

4 0
3 years ago
Other questions:
  • Convert 0.025 in into mm.
    11·2 answers
  • Which of the following can minimize engine effort in save fuel
    15·2 answers
  • How far do you jog each morning? You prefer to jog in different locations each day and do not have a pedometer to measure your d
    14·1 answer
  • A lab technician is ordered to take a sample of your blood. As she inserts the needle, she says, "My, you have tough skin!" What
    14·1 answer
  • What is this i dont understand this at all
    9·1 answer
  • ____________ is the organization that oversees environmental compliance.
    14·1 answer
  • prove that the heat transfer at the constant pressure is given by the enthalpy change during the process​
    7·1 answer
  • Technician A says that the low level brake fluid switch on a master cylinder will turn on the brake warning light when the syste
    9·1 answer
  • What is included in the environmental impact assessment process, such as the use of geographic information systems?
    15·1 answer
  • when a unit load is secured to a pallet, it is more difficult for pilferage to take place. true false
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!