Create an object bottle that has a property that is an object: cap. cap can have properties like material: 'metal' or 'plastic', color: blue or white etc. Log one of the properties of that inner object. 1

Create an object bottle that has a property that is an object: cap. cap can have properties like material: ‘metal’ or ‘plastic’, color: blue or white etc. Log one of the properties of that inner object.

Combining Datatypes

Here is what the above code is Doing:
1. We create a list of tuples, where each tuple is a name, age, and a list of hobbies.
2. We create a list of dictionaries, using a list comprehension. Each dictionary has a name, age, and list of hobbies.
3. We create a list of namedtuples, using a list comprehension. Each namedtuple has a name, age, and list of hobbies.

Similar Posts