Reputation: 3
I want to use the function f
in the function radiationExposure
, but this code return nothing.
def f(x):
import math
return 10*math.e**(math.log(0.5)/5.27*x)
def radiationExposure(start, stop, step):
if start < 0 or stop < start or step < 0:
print("Invalid inputs!")
else:
result = 0 # Total radiation exposure area
for i in range(start, stop + 1):
result += f(i)*step
return result
radiationExposure(5, 10, 1)
Upvotes: 0
Views: 77
Reputation: 1121744
When you run a Python script, it will not auto-echo the result. Your code runs fine, but you need to explicitly print the result:
print(radiationExposure(5, 10, 1))
Your script, when run, will now print 22.9424104106
.
Upvotes: 4