Feat: import Expression from calculus and docstring in random

This commit is contained in:
2019-05-08 14:44:35 +02:00
parent f87e6c5727
commit 7413a76f8d
2 changed files with 61 additions and 1 deletions

View File

@@ -0,0 +1,39 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2017 lafrite <lafrite@Poivre>
#
# Distributed under terms of the MIT license.
"""
Function to create random strings
:example:
>>> form = "{a} / {b} + {c} / {k*b}"
>>> conditions = [
... "abs({b}) != 1",
... "{d} > 1",
... "{b} != {d}",
... "gcd({a},{b}) == 1",
... "gcd({c},{k*b}) == 1",
... ]
>>> #random_str(form, conditions)
>>> form = "{a:int}x + {b:fraction}"
>>> conditions = [
... "{b.denom} > 2",
... ]
>>> #random_str(form, conditions)
"""
import random
__all__ = []
# -----------------------------
# Reglages pour 'vim'
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
# cursor: 16 del