Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Math is not defined? (Python)


I’m trying to use math.sqrt() and random.randrange() in, among other levels, Sarven Brawl.
for sqrt() in math I get an error saying math isn’t defined… or if I import sqrt from math I’m told sqrt doesn’t exist…
for random.randrange() it claims random has no method randrange()

now, random.random() seems to be available when I import random so I manage to make my own randrange equivalent rather easily… (gotta have some pseudo-randomness to make my hero look smart you know)
I can’t say the same for sqrt() or anything else I’ve tried to use from the math library so far… this is a bug right?

Now, IF these, by design, just aren’t available for the levels that I’m trying to use them on…
Can’t you guys include a list of default python libraries containing lists of the methods from each of them that are available for each level?.. you know for that sidebar that lets you read about the codecombat methods…