Put example in API/__ini__

This commit is contained in:
Bertrand Benjamin 2018-09-20 18:40:04 +02:00
parent 49a09fd52c
commit d09d8a3d98

View File

@ -7,6 +7,31 @@
# Distributed under terms of the MIT license. # Distributed under terms of the MIT license.
""" """
Generate and compute like a student!
:example:
>>> e = Expression.from_str("2+3*4")
>>> e_simplified = e.simplify()
>>> print(e_simplified)
14
>>> for s in e_simplified.explain():
... print(s)
2 + 3 * 4
2 + 12
14
>>> e = Expression.from_str("2+3/2")
>>> e_simplified = e.simplify()
>>> print(e_simplified)
7 / 2
>>> for s in e_simplified.explain():
... print(s)
2 + 3 / 2
2 / 1 + 3 / 2
(2 * 2) / (1 * 2) + 3 / 2
4 / 2 + 3 / 2
(4 + 3) / 2
7 / 2
""" """