
SUVODEEP DUBEY
2,470 PointsMap Comprehension Error In Code Challenge
Please find the code below I am getting expected result in my Notebook but in the console I am getting Error that 'int' is not subscriptable
dimensions = [
(5, 5),
(10, 10),
(2.2, 2.3),
(100, 100),
(8, 70),
]
def area(dim):
return list(map(lambda x: x[0]*x[1], dim))
a = area(dimensions)
2 Answers

Steven Parker
204,840 PointsYou've written a function that does something different from what the instructions asked for. Take another look at the instructions for task 1:
"Create a function named area()
that takes a single argument which will be a two-member tuple. area()
should return the result of multiplying the first item in the tuple by the second item in the tuple."
Note that the function should take a single tuple argument instead of a list of them, and return a numeric value instead of a list. The provided "dimensions" list won't be used until task 2, and with a comprehension instead of a "map".

SUVODEEP DUBEY
2,470 PointsThanks Steven I got the point