/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
calculator/use__simpleeval__module.py
15 строк
518 B
gil9red
Refactoring. Using black code style
25 апр 2023, 14:17
25 апр 2023, 14:17
fd34d72
Код
Авторство
О чём код?
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "ipetrash" # pip install simpleeval from simpleeval import simple_eval print(simple_eval("21 + 21")) # 42 print(simple_eval("2 + 2 * 2")) # 6 print(simple_eval("10 ** 123")) # 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 print(simple_eval("21 + 19 / 7 + (8 % 3) ** 9")) # 535.7142857142857 print(simple_eval("square(11)", functions={"square": lambda x: x * x})) # 121