शंतनू wrote:
> s = [sum(x) for x in matrix]
> for q in sorted([(x,y) for x,y in enumerate(s)],
> key=operator.itemgetter(1)):
> print("Employee %d has worked %d hours" % (q[0], q[1]))
A minor simplification:
s = (sum(x) for x in matrix)
for q in sorted(enumerate(s), key=operator.itemgetter(
Reply inline.
On 23/01/13 8:22 AM, anthonym wrote:
> Hello All,
>
> I originally wrote this program to calculate and print the employee
> with the most hours worked in a week. I would now like to change this
> to calculate and print the hours for all 8 employees in ascending order.
>
> The employ
Thanks Dave. I forgot to hit the reply to all last time. I am going to
try the loop when I get back home and will let you know how I make out.
Also we have done some functions. Sort and append being among them. I
try the simplest way first then stream line later. Probably not the
fastest way.
On 01/23/2013 06:13 PM, Alan Gauld wrote:
On 23/01/13 03:08, Mitya Sirenef wrote:
>
>> To make the change you need, use list comprehension to make sums of all
>> rows, sort it (using list sort method); iterate over it using
>> enumerate() and print out "employee N, sum of hours:"
>
> One proble
On 01/23/2013 06:13 PM, Alan Gauld wrote:
On 23/01/13 03:08, Mitya Sirenef wrote:
To make the change you need, use list comprehension to make sums of all
rows, sort it (using list sort method); iterate over it using
enumerate() and print out "employee N, sum of hours:"
One problem with that a
On 23/01/13 03:08, Mitya Sirenef wrote:
To make the change you need, use list comprehension to make sums of all
rows, sort it (using list sort method); iterate over it using
enumerate() and print out "employee N, sum of hours:"
One problem with that approach is that the employees are identifie
On 01/22/2013 11:18 PM, anthonym wrote:
Thanks Dave
I think I would like to keep it simple. How would I get it to repeat and
print before deleting?
To repeat something, write a loop. So you have a while loop *outside*
the one you've written (you'll have to indent your present loop another
Thanks Dave
I think I would like to keep it simple. How would I get it to repeat and
print before deleting?
On 1/22/13 7:10 PM, "Dave Angel" wrote:
>On 01/22/2013 09:52 PM, anthonym wrote:
>> Hello All,
>>
>> I originally wrote this program to calculate and print the employee
>>with the
>> mos
On 01/22/2013 10:34 PM, Dave Angel wrote:
On 01/22/2013 10:08 PM, Mitya Sirenef wrote:
>> On 01/22/2013 09:52 PM, anthonym wrote:
>>> Hello All,
>> >
>> > I originally wrote this program to calculate and print the employee
>> > with the most hours worked in a week. I would now like to change th
On 01/22/2013 10:08 PM, Mitya Sirenef wrote:
On 01/22/2013 09:52 PM, anthonym wrote:
Hello All,
>
> I originally wrote this program to calculate and print the employee
> with the most hours worked in a week. I would now like to change this
> to calculate and print the hours for all 8 employ
On 01/22/2013 09:52 PM, anthonym wrote:
Hello All,
I originally wrote this program to calculate and print the employee with the
most hours worked in a week. I would now like to change this to calculate
and print the hours for all 8 employees in ascending order.
The employees are named employee
On 01/22/2013 09:52 PM, anthonym wrote:
Hello All,
>
> I originally wrote this program to calculate and print the employee
> with the most hours worked in a week. I would now like to change this
> to calculate and print the hours for all 8 employees in ascending
> order.
>
> The employees are na
Hello All,
I originally wrote this program to calculate and print the employee with the
most hours worked in a week. I would now like to change this to calculate
and print the hours for all 8 employees in ascending order.
The employees are named employee 0 - 8
Any ideas?
Thanks,
Tony
Code bel
13 matches
Mail list logo