Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7605003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:03:26+00:00 2026-05-31T00:03:26+00:00

Question: write a program which first defines functions minFromList(list) and maxFromList(list). Program should initialize

  • 0

Question: write a program which first defines functions minFromList(list) and maxFromList(list). Program should initialize an empty list and then prompt user for an integer and keep prompting for integers, adding each integer to the list, until the user enters a single period character. Program should than call minFromList and maxFromList with the list of integers as an argument and print the results returned by the function calls.

I can’t figure out how to get the min and max returned from each function separately. And now I’ve added extra code so I’m totally lost. Anything helps! Thanks!

What I have so far:

def minFromList(list)

texts = []
    while (text != -1):
    texts.append(text)

high = max(texts)

return texts 

def maxFromList(list)

texts []
    while (text != -1):
    texts.append(text)

low = min(texts)

return texts



text = raw_input("Enter an integer (period to end): ")
list = []
while text != '.':
    textInt = int(text)
    list.append(textInt)
    text = raw_input("Enter an integer (period to end): ")

print "The lowest number entered was: " , minFromList(list)
print "The highest number entered was: " , maxFromList(list) 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T00:03:27+00:00Added an answer on May 31, 2026 at 12:03 am

    I think the part of the assignment that might have confused you was about initializing an empty list and where to do it. Your main body that collects data is good and does what it should. But you ended up doing too much with your max and min functions. Again a misleading part was that assignment is that it suggested you write a custom routine for these functions even though max() and min() exist in python and return exactly what you need.

    Its another story if you are required to write your own max and min, and are not permitted to use the built in functions. At that point you would need to loop over each value in the list and track the biggest or smallest. Then return the final value.

    Without directly giving you too much of the specific answer, here are some individual examples of the parts you may need…

    # looping over the items in a list
    value = 1
    for item in aList:
        if item == value:
            print "value is 1!"
    
    # basic function with arguments and a return value
    def aFunc(start):
        end = start + 1
        return end
    print aFunc(1)
    # result: 2
    
    # some useful comparison operators
    print 1 > 2  # False
    print 2 > 1  # True
    

    That should hopefully be enough general information for you to piece together your custom min and max functions. While there are some more advanced and efficient ways to do min and max, I think to start out, a simple for loop over the list would be easiest.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Question: Write a program which first defines a function evens(n). The function should take
This is the question. write a program that prompts the user to input five
Question: Should I write my application to directly access a database Image Repository or
I want to ask a question about the iPhone application. I write a program
I have a question. I want to write a chess like program applying the
I need to write a program which will deskew scanned images. I've chosen Qt
I am trying to write my first program in C++, and I need to
First: I know how to write the program, so I'm not asking for help
This is a homework question. I have to write a program forking itself 20
Here is the question: write a method that swaps two variables. These two variables

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.