473,395 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to output highest and lowest number from all the entries??

I got this program running and gives me result that I want (actually not yet). Now I want to find out the lowest and highest numbers I entered. Andy advise???

Expand|Select|Wrap|Line Numbers
  1. number = int (input ("Enter a positive number that is below 126: "))
  2. if number > 125:
  3.     print "The number entered has to be 125 or lower.\n"
  4.     number = input ("Enter a positive number that is below 126: ")
  5. else:
  6.     total = 0
  7.     total += number 
  8.     while total <= 501:
  9.         total += number
  10.         number = input ("Enter another number that 125 or below : ")
  11.     if total >= 500:
  12.         print "Total of your entered numbers is ", total\
  13.  
Dec 6 '06 #1
1 5852
bvdet
2,851 Expert Mod 2GB
Initialize a list:
Expand|Select|Wrap|Line Numbers
  1. num_list = []
After the user enters a number, append it to the list:
Expand|Select|Wrap|Line Numbers
  1. num_list.append(num)
At the appropriate time:
Expand|Select|Wrap|Line Numbers
  1. print min(num_list)
  2. print max(num_list)
Dec 7 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: nick_faye | last post by:
hi guys, im still a newbie in ms-access and i would like to ask how can i get the highest and the lowest date in ms-access report? for example, i have these entries: 10/1/2003 10/5/2003...
21
by: Jaspreet | last post by:
I was working on some database application and had this small task of getting the second highes marks in a class. I was able to do that using subqueries. Just thinking what is a good way of...
6
by: Matt Chwastek | last post by:
Anyone who can help, I am curretnly attempting to write some code that will allow iteration using a vector<intfrom the highest possilbe degree of a combination of ones & zeros (111, 110, 101,...
5
by: owz | last post by:
Hi again had some more problems, all help welcome. Access 2000, SQL My problem is as stated in the title. I want 2 display the highest and lowest priced car sold for this month. This is what I...
17
by: rhitz1218 | last post by:
Hi, I'm trying to create a function that will sort a number's digits from highest to lowest. For example 1000 - will become 0001 or 1234 to 4321
2
noylec
by: noylec | last post by:
Hi! Can you please help me with this problem? I'm new in C programming that's why I'm having some trouble in some problems... Here's the Problem: Create a C program using array that will ask the...
13
by: td0g03 | last post by:
Hello again guys. I have a question. I'm working on a program for my class and I'm stuck on how to find the lowest and highest number of a user input. We aren't at arrays yet so that's out of the...
4
by: someone124 | last post by:
Hi, everyone. I'm trying to find the lowest and the highest numbers that a user has had punched in. The code includes a user punching in 4 different numbers, each on a different line. I need help...
5
by: AB3004 | last post by:
Hey there, Just wanted to say Hi. - I'm new on here & have drifted here as I'm having a minor problem I was hoping someone could assist ...? (for some reason I couldn't post this directly into the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.