Complete the code to import the correct Pydantic type for a list of strings.
from pydantic import BaseModel, [1] class Item(BaseModel): tags: [1][str]
The List type from Pydantic is used to validate lists of items, such as strings.
Complete the code to import the correct Pydantic type for a set of integers.
from pydantic import BaseModel, [1] class Numbers(BaseModel): unique_ids: [1][int]
The Set type from Pydantic is used to validate sets, which are unordered collections of unique items.
Fix the error in the code to correctly validate a list of strings using Pydantic.
from pydantic import BaseModel, [1] class User(BaseModel): hobbies: [1][str]
To validate a list of strings, use List[str] from Pydantic.
Fill both blanks to define a Pydantic model with a list of strings and a set of integers.
from pydantic import BaseModel, [1], [2] class Data(BaseModel): names: [1][str] ids: [2][int]
List is used for ordered collections, and Set for unique unordered collections.
Fill all three blanks to create a Pydantic model with a list of strings, a set of integers, and a tuple of floats.
from pydantic import BaseModel, [1], [2], [3] class Metrics(BaseModel): labels: [1][str] unique_codes: [2][int] scores: [3][float]
Use List for ordered lists, Set for unique unordered sets, and Tuple for fixed-length ordered collections.