mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
* Improve generator __init__ function * Move Generator to new file, remove mathgen * Remove getGenList redundancies * Add backwards compatibility import mathgen from * Insort to genList * Linter fixes * Lint fixes
21 lines
539 B
Python
21 lines
539 B
Python
from ...generator import Generator
|
|
import random
|
|
import math
|
|
|
|
|
|
def gen_func(maxRadius=100, format='string'):
|
|
r = random.randint(0, maxRadius)
|
|
circumference = 2 * math.pi * r
|
|
|
|
if format == 'string':
|
|
problem = f"Circumference of circle with radius {r}"
|
|
return problem, circumference
|
|
elif format == 'latex':
|
|
return "Latex unavailable"
|
|
else:
|
|
return r, circumference
|
|
|
|
|
|
circumference = Generator("Circumference", 104, gen_func,
|
|
["maxRadius=100"])
|