Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Andy Hughes](https://uploads.teamtreehouse.com/production/profile-photos/11657454/micro_me-profile.jpg)
Andy Hughes
8,479 PointsMap comprehension. Question is confusing!
So once again, I've wasted more time than needed, overthinking the question for this challenge.
If you're doing part one, just ignore the 'dimensions' list because it's largely irrelevant for part 1. At first when I read the question and it said 'create a function named area that takes two arguments from a tuple list, I ended with this:
def area([arg1, arg2]):
(Ok so I'm still a noob!) The question doesn't mean that you're writing two arguments into the function. It simply means that the list contains a tuple with a series of paired arguments. So you need to be aware that you will reference a first item and second item.
In our area() function, our argument is going to be the variable 'dimension', which is a single argument. In essence, ignoring the 'dimensions' list altogether, this is like saying, create a function that will multiply two items together that are contained in one variable.
However, because the 'dimensions' variable contains paired items in the list, our function needs to know how to choose the first item and second items independently. So remembering [keys], we can reference our argument 'dime' and just tell it whether it's the first item '[0]', or the second item '[1]'.
For the second part, we're simply writing a list comprehension style query as per the end of the 'Map' video. Kenneth shows it a couple of minutes before the end.
Hope that helps someone else as it confused the heck out of me at first!
dimensions = [
(5, 5),
(10, 10),
(2.2, 2.3),
(100, 100),
(8, 70),
]
def area(dime):
return dime[0] * dime[1]
areas = [area(dime) for dime in dimensions]
1 Answer
![Mel Rumsey](https://uploads.teamtreehouse.com/production/profile-photos/11534325/micro_yellow.jpg)
Mel Rumsey
Treehouse ModeratorAndy Hughes Thank you for sharing your thought process and how you worked through this. Nice job and I am sure it will help someone else if they get stuck on this one! ^-^