LinkedIn Python Skill Assessment Quiz Answers

What does calling namedtuple on a collection type return?

Latest Update on 25th January, 2022 by Certification Course Answers

What does calling namedtuple on a collection type return?

  1.  a generic object class with iterable parameter fields
  2.  a generic object class with non-iterable named fields
  3.  a tuple subclass with non-iterable parameter fields
  4.  a tuple subclass with iterable named fields

Correct Answer:

  •  a tuple subclass with iterable named fields

Example:

import math
radius = [1,2,3]
area = list(map(lambda x: round(math.pi*(x**2), 2), radius))
area
>>> [3.14, 12.57, 28.27]

Latest Updates

No posts found in this category.