BaşlayınÜcretsiz Başlayın

Check your types

A class called UserProfile has been defined for you that inherits from BaseModel:

from pydantic import BaseModel
from typing import Optional

class UserProfile(BaseModel):
    username: str
    interests: list[str]
    age: Optional[int] = None
    email: str

Which of the following pieces of code will run without errors, which mean they'd pass the schema validation checks?

Bu egzersiz

Introduction to MongoDB in Python

kursunun bir parçasıdır
Kursu Görüntüle

Uygulamalı interaktif egzersiz

İnteraktif egzersizlerimizden biriyle teoriyi pratiğe dökün

Egzersizi başlat