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
jok3333 [9.3K]
2 years ago
14

create your own min function that finds the minimum element in a list and use it in a separate function

Computers and Technology
1 answer:
schepotkina [342]2 years ago
5 0

Answer:

def minfunction(mylist):

   min = mylist[0]

   for i in mylist:

       if i < min:

           min = i

   print("The minimum is: "+str(min))

   

def anotherfunction():

   mylist = []

   n = int(input("Length of list: "))

   for i in range(n):

       listelement = int(input(": "))

       mylist.append(listelement)

   minfunction(mylist)

   

anotherfunction()

Explanation:

This solution is implemented in Python

This defines the min function

def minfunction(mylist):

This initializes the minimum element to the first index element

   min = mylist[0]

This iterates through the list

   for i in mylist:

This checks for the minimum

       if i < min:

... and assigns the minimum to variable min

           min = i

This prints the minimum element

   print("The minimum is: "+str(min))

   

This defines a separate function. This  separate function is used to input items into the list

def anotherfunction():

This defines an empty list

   mylist = []

This prompts user for length of list

   n = int(input("Length of list: "))

The following iteration inputs elements into the list

<em>    for i in range(n):</em>

<em>        listelement = int(input(": "))</em>

<em>        mylist.append(listelement)</em>

This calls the minimum function

   minfunction(mylist)

   

The main starts here and this calls the separate function

anotherfunction()

You might be interested in
The Clean Air Act Amendments of 1990 prohibit service-related releases of all ____________. A) GasB) OzoneC) MercuryD) Refrigera
velikii [3]

Answer:

D. Refrigerants

Explanation:

In the United States of America, the agency which was established by US Congress and saddled with the responsibility of overseeing all aspects of pollution, environmental clean up, pesticide use, contamination, and hazardous waste spills is the Environmental Protection Agency (EPA). Also, EPA research solutions, policy development, and enforcement of regulations through the resource Conservation and Recovery Act .

The Clean Air Act Amendments of 1990 prohibit service-related releases of all refrigerants such as R-12 and R-134a. This ban became effective on the 1st of January, 1993.

Refrigerants refers to any chemical substance that undergoes a phase change (liquid and gas) so as to enable the cooling and freezing of materials. They are typically used in air conditioners, refrigerators, water dispensers, etc.

4 0
2 years ago
Explain how loops can be utilized in list processing. Please provide Python examples in your response.
Dominik [7]

Answer:

data = [0,1,2,3,4]

for i in range(4):

   print(data[i])

   i+=1

Explanation:

Loops can be utilized in a listing process by looping back to a list with a variable while the loop increases that variable to give a different response from the list.

8 0
1 year ago
A _____ object is the instance of a class that receives a request from another object. Select one: a. client b. server c. contra
creativ13 [48]

Answer:

b. server

Explanation:

A server serves responses to requests from client objects.

5 0
3 years ago
In the game Singularity, broken objects can be restored to their original condition by reversing time. This is an example of whi
Zolol [24]

Solution:

In the game Singularity, broken objects can be restored to their original condition by reversing time. This is an example of which time element of player adjustment.

Thus the required answer is player adjusted.

6 0
3 years ago
Read 2 more answers
From which tab can you format individual cell data like any other text? A.Design B. Home C. Table Tools Design D.Table Tools Lay
skelet666 [1.2K]
The answer to this question is the letter "B" which is the HOME tab. When you click the home tab, you can find the different number format in such a way that you can also format the individual cell, it could be data of any other text.
6 0
2 years ago
Other questions:
  • How many spaces is equal to one tab on a keyboard? When I compose emails, the tab button doesn't indent for me, so how many time
    7·1 answer
  • Why is it difficult to enforce laws against intellectual theft?
    10·1 answer
  • What is the recommended size for bulleted text?
    5·2 answers
  • ICT excel data homework
    10·1 answer
  • You plan to use the Fill Down feature on a formula in Excel and need to keep a cell reference the same. Which format allows you
    6·1 answer
  • Write a algorithm to attend birthday party​
    8·2 answers
  • I have a very quick question. So im applying for Early college and i need some future educational goals and maybe im just thinki
    6·1 answer
  • Write a function that accepts a positive random number as a parameter and returns the sum of the random number's digits. Write a
    10·1 answer
  • Does anybody have the answer for 2.19.6 checkerboard for codehs??
    9·1 answer
  • A(n) ____ describes the structure, content, and access controls of a physical data store or database.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!