Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #58619

Re: Help with my programming homework (python, and raptor)

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.python
Subject Re: Help with my programming homework (python, and raptor)
Date 2013-11-07 02:13 +0000
Organization A noiseless patient Spider
Message-ID <l5et11$3i4$2@dont-email.me> (permalink)
References <d8904015-8e4b-4bda-96aa-1222ac3cfbff@googlegroups.com>

Show all headers | View raw


On Wed, 06 Nov 2013 16:56:26 -0800, jonny seelye wrote:

> Since the name of the employee will be a string and the
> salary will be a number, you decide to use two parallel 
> arrays to store the data.

The hell I do! I decide to do this:

# data initialisation

minsal = maxsal = sumsal = 0.0
minpers = []
maxpers = []

# employee and salary input processing

get the number of employees
check the number is > 0

for 1 to number of employees
	get the name
	get the salary

	if minsal == 0.0
		note minsal
		set the minpers list to name
	else if salary < minsal
		note minsal
		set the minpers list to name
	else if salary == minsal
		append name to the minpers list

	similar for maxsal & maxpers

	sumsal += salary

# outputs

average salary = # calculate

maximum salary = 
people receiving = 

similar for minimum

I might have missed something from the original spec, but as I recall, 
you just wanted min, max and avg salaries, and to know who was getting 
the min and max, yes?

-- 
Denis McMahon, denismfmcmahon@gmail.com

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Help with my programming homework (python, and raptor) jonny seelye <casioboy12@gmail.com> - 2013-11-06 16:56 -0800
  Re: Help with my programming homework (python, and raptor) Chris Angelico <rosuav@gmail.com> - 2013-11-07 12:07 +1100
    Re: Help with my programming homework (python, and raptor) Alister <alister.ware@ntlworld.com> - 2013-11-07 10:14 +0000
  Re: Help with my programming homework (python, and raptor) Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-07 02:13 +0000

csiph-web