Skip to content

Commit 3d1ce3e

Browse files
committed
Added usage example in the readme
1 parent ca4dc26 commit 3d1ce3e

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

README.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,21 @@ Usage
8383
The application has been coded in Python, without using any particular
8484
framework.
8585

86+
To use it just import the parser:
87+
88+
>>> from dice_notation.parser import DiceParser
89+
90+
And then use it to parser a dice notation expression:
91+
92+
>>> parser = DiceParser()
93+
>>> dice = parser.parse('1d6+2')
94+
95+
The result can be accessed just by calling the 'roll' method as many times as
96+
needed, which will generate a new random value each time it is called.
97+
98+
>>> print(dice.roll())
99+
>>> print(dice.roll())
100+
86101
Collaborate
87102
-----------
88103

dice_notation/__main__.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)