1. Turn Book into a dataclass
Write code Easy ✓ CompletedMake Book a dataclass with the fields title (str), author (str) and pages (int, default 100). Do not write __init__ or __repr__ yourself.
For example Book("Dune", "Frank Herbert", 412) should print as Book(title='Dune', author='Frank Herbert', pages=412).
from dataclasses import dataclass
class Book:
# add the decorator above the class and the three fields here
pass
title: str. A default value goes after the annotation: pages: int = 100.from dataclasses import dataclass
@dataclass
class Book:
title: str
author: str
pages: int = 100
print(Book("Dune", "Frank Herbert", 412))