Python Forum
Exercise about list of lists
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exercise about list of lists
#3
Thanks for your answer, I think I almost got every point of your post (I'll write the function but I know how to do that so it's not an issue):

#!/usr/bin/python3

L = [[1,2,3],[5,6]] 

a = [sum(i) for i in L]
    
print (a)
Did you mean to do something like this?
Reply


Messages In This Thread
Exercise about list of lists - by Otbredbaron - May-03-2018, 07:43 PM
RE: Exercise about list of lists - by micseydel - May-03-2018, 08:07 PM
RE: Exercise about list of lists - by Otbredbaron - May-03-2018, 08:30 PM
RE: Exercise about list of lists - by micseydel - May-03-2018, 09:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  List all possibilities of a nested-list by flattened lists sparkt 1 1,760 Feb-23-2023, 02:21 PM
Last Post: sparkt
  user input values into list of lists tauros73 3 1,949 Dec-29-2022, 05:54 PM
Last Post: deanhystad
  returning a List of Lists nafshar 3 1,939 Oct-28-2022, 06:28 PM
Last Post: deanhystad
  Creating list of lists, with objects from lists sgrinderud 7 3,063 Oct-01-2022, 07:15 PM
Last Post: Skaperen
  How to efficiently average same entries of lists in a list xquad 5 3,210 Dec-17-2021, 04:44 PM
Last Post: xquad
  sorting a list of lists by an element leapcfm 3 2,814 Sep-10-2021, 03:33 PM
Last Post: leapcfm
  behavior list of lists roym 5 3,424 Jul-04-2021, 04:43 PM
Last Post: roym
  List of lists - merge sublists with common elements medatib531 1 4,096 May-09-2021, 07:49 AM
Last Post: Gribouillis
  Sort List of Lists by Column Nju 1 15,767 Apr-13-2021, 11:59 PM
Last Post: bowlofred
  Exercise List Overlap Damian 7 5,012 Apr-02-2021, 07:39 AM
Last Post: Damian

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020