Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Timer Context Manager | Practice with Context Managers
Practice
Projects
Quizzes & Challenges
Вікторини
Challenges
/
Python Context Managers
Секція 3. Розділ 1
single

single

bookChallenge: Timer Context Manager

Свайпніть щоб показати меню

Завдання

Swipe to start coding

Implement a context manager that measures and prints the elapsed time when exiting a context. The context manager should use the context management protocol. The __enter__ method should record the current time. The __exit__ method should record the end time, calculate the elapsed time, and print the duration in seconds.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 1
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

some-alt