1. Uczyć się
  2. /
  3. Courses
  4. /
  5. Pythonで学ぶMongoDB入門

Connected

Exercise

型をチェックしましょう

BaseModel を継承した UserProfile クラスが用意されています。

from pydantic import BaseModel
from typing import Optional

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

次のコードのうち、エラーなく実行できる(つまりスキーマ検証をパスする)のはどれでしょうか?

Instrukcje

50 XP

Możliwe odpowiedzi