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]
3 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]3 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
Describe the benefits and drawback of using virtualisation on a single machine and also in a cluster environment
Sedbober [7]

Answer:

 Virtualization is the technology that is used to create virtual representation and version of the different devices like software, many storage devices and server.

It also help in organize the working framework where the structure isolates the asset into at least one execution situations.

 The benefits of using the virtualization on the single machine are:

  •  The virtualization increased the productivity when it used in the cluster environment.
  •  We can able to access the different resources faster.
  •   The data center management is simple while using the virtualization in the cluster environment.

 The drawback of using virtualization on single machine are:

  • The virtual machine is less efficient as compared to the real machines.
  • The virtual machine indirectly access the computer hardware system so that is why it is less efficient and also consume more power to run the system.  

5 0
3 years ago
Which of the following is considered a benefit when using slab allocator?
tatyana61 [14]

Answer:

Option(d) is the correct answer to the given question

Explanation:

The main advantage of slab allocator is that There is no memory is lost because of the fragmentation this is due to some driver data framework has a cache memory that is connected to it.

  • In the slab allocator the resources are repeatedly assigned or free to handle them. It is a type of memory management scheme that is used for distributing resources to the memory.
  • All the other options are not considered as advantages of Slab allocator that's why they are an incorrect options.
7 0
3 years ago
The top of a ladder must extend how many feet above the surface a worker is climbing onto?
Alika [10]
<span>The answer is THREE FEET. This is part of the safety precautions that must be taken when using ladder. Other safety precautions include: only used inspected and certified ladders, keep ladders at least ten feet away from power lines, do not use ladder on slippery surfaces, etc.</span><span />
6 0
3 years ago
Def sum_divisors(n): sum =1 # Return the sum of all divisors of n, not including n x=int(n**0.5) for i in range(2,(x//1)+1): if
Novosadov [1.4K]

Answer:

This is a python program that counts the number of divisors of a given number and calculates the sum of the divisors.

Explanation:

The first line defines a function "sum_divisors" with an argument "n". The square root of the argument is converted to integer and assigned to the variable "x", then a for loop is used to iterate through the range 2 to the calculated nth number of divisors in the argument.The return keyword returns the sum value.

The function is called with several arguments and printed with the print function.

6 0
3 years ago
World pade is world processing software true or false​
Evgesh-ka [11]

Answer:

yes

Explanation:

5 0
3 years ago
Other questions:
  • Calculate the total number of bits transferred if 200 pages of ASCII data are sent using asynchronous serial data transfer. Assu
    5·1 answer
  • Rachel is on her way to an interview for the position of a project manager. She is trying to prepare for this interview by analy
    6·1 answer
  • Is there a way to find the answers to I ready on the internet?
    6·1 answer
  • How did mark watney survive the accident
    9·1 answer
  • ________ programming is a method of writing software that centers on the actions that take place in a program.
    8·1 answer
  • Write a function safeOpen() that takes one parameter, filename — a string giving the pathname of the file to be opened for readi
    15·1 answer
  • You change a document that is saved on your computer by cutting text from the document what happens to the text when you preform
    5·1 answer
  • The ______________ shows that you have fully researched the topic and gives you a chance to prove your claim.
    8·1 answer
  • Why do you want to work from our company?​
    9·2 answers
  • What is the name of the directory that contains symbolic links to unix sysv rc scripts for runlevel 2?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!