/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
0.0.0
exit_handler.py
26 строк
495 B
ipetrash
#
07 мар 2018, 14:31
07 мар 2018, 14:31
c05cce9
Код
Авторство
О чём код?
#!/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('Execution time: {:.3f} secs.'.format(timer() - start_time)) atexit.register(exit_handler) # OR with decorator: @atexit.register def exit_handler(): print('Execution time: {:.3f} secs.'.format(timer() - start_time)) number = int(input('Input number: ')) print('My super sum:', sum(range(number ** 2)))