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
A communication between two devices is over the maximum limit of an ethernet frame size. The Transmission Control Protocol (TCP)
umka2103 [35]

Answer:

D. Sequence number

Explanation:

The sequence number facilitates the keeping track of many segments. This enables it to determine which segments out of many in which it should be in. The sequence number field is usually 32 bits.

Sequence numbers are used in transmitting data because of their importance. Since data is transmitted in packets, they can be lost and as such the receiver uses the sequence numbers to reorder them.

6 0
3 years ago
According to the video, what tasks do Carpenters commonly perform? Select four options. supervising Plumbers, Electricians, and
TiliK225 [7]

Answer:

Cutting, shaping, and fastening wood.

Installing rafters, joists, windows, and subflooring.

Setting hardwood floors.

Building kitchen cabinets.

7 0
2 years ago
Read 2 more answers
In the word interrupting, the root word rupt means:
Tatiana [17]
A. break, because if you were to interrupt someone mid-conversation you would essentially be 'breaking' their speech. In erupt it seems more like burst but could also be break because the lava erupting from the volcano breaks or damages its surroundings. Just a guess.
5 0
3 years ago
Read 2 more answers
Define the function merge_year that aggregates the feeding log data for the given year. Your function definition should not use
Molodets [167]

Answer:

sorry just for points

Explanation:

lol I'm sorry but come play among us lol

6 0
2 years ago
Lucy wants to attach a goal cost to each of her life goals. Why might she do this?
miss Akunina [59]
She wants to identify the amount of money, time, and effort required to realize her goals.
3 0
3 years ago
Read 2 more answers
Other questions:
  • We have to calculate the percentage of marks obtained in three subjects (each out of 100) by student A and in four subjects (eac
    11·1 answer
  • Which of the following commands is more recommended while creating a bot?
    9·1 answer
  • If you feel that an OSHA inspection is needed to get hazards corrected at your workplace, which is your best option?
    7·1 answer
  • What is Scrum?
    14·1 answer
  • Write a program to generate personalized junk mail. The program takes input both from an input file and from the keyboard.The in
    14·1 answer
  • What’s bigger 4,000,000 KB or 2.8 GB
    5·2 answers
  • Which of the following information should be included in audit documentation? a. Procedures performed. b. Audit evidence examine
    13·1 answer
  • Give an example of a file suffix for the files created by each of the following: 1) a word processing program 2) a spread sheet
    14·1 answer
  • NEED HELP FAST TIMED !!!!
    12·2 answers
  • Python coding beginners question
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!