Here is the code I'm trying to import to get it working for a project.
import random
def ReturnHit(denominator,numerator):
if (denominator == 0):
denominator = 1
if (numerator == 0):
numerator = 1
num = random.randint(1,denominator)
#if num is less than a the numberator then return yes on the hit
if (num < numerator):
return True
else:
return False
def ReturnApproxCurvedHit(average,lowerLimit,upperLimit):
#return true or false based on probability position in the bell curve
n = range(lowerLimit,upperLimit)
for i in n:
if(ReturnHit(1,abs(average - i)*2)):
return True
else:
return False
Then there's my main where I set up functions to test if I'm importing everything right. My test functions work perfectly fine even returning everything perfectly. The test function says 'hello' and returns '0' of course. But the stat.py file won't let me use ReturnHit.
#I need to find a way to test the stat.py
import stat
import module
module.say_hello()
z = module.zero()
print(z)
stat.ReturnHit(1,10)
It spits out an error the goes:
Traceback (most recent call last):
File "main.py", line 11, in <module>
stat.ReturnHit(1,10)
AttributeError: module 'stat' has no attribute 'ReturnHit'
I'm on replit btw.