/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
exit_handler.py
28 строк
479 B
gil9red
Refactoring. Using f-strings
26 июн 2023, 11:29
26 июн 2023, 11:29
48dd9f0
Код
Авторство
О чём код?
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "ipetrash" import atexit from timeit import default_timer as timer start_time = timer() def exit_handler(): print(f"Execution time: {timer() - start_time:.3f} secs.") atexit.register(exit_handler) # OR with decorator: @atexit.register def exit_handler(): print(f"Execution time: {timer() - start_time:.3f} secs.") number = int(input("Input number: ")) print("My super sum:", sum(range(number**2)))