Apr-10-2019, 05:24 PM
(Apr-10-2019, 06:37 AM)j.crater Wrote: Hello, for starters
def Gos_Erlang(A,C):
This function does not return any value, which is ok, but the problem would be line #17 - gos d (which by the way is not allowed variable name due to whitespace).
And functiondef (gos, C):
needs a name.
I am having issues with the last define function, its telling me that the return is undefined
import math def fact(n): ans = 1 for i in range(2 , n + 1): ans*=i return ans def Gos_erlang(A0,n): numera = math.pow(A0 , n) / fact(n) denomi = 0 for k in range(0, n+1): denomi += math.pow( A0 , k ) / fact(k) Gos = numera / denomi return Gos Gos = float(input('Enter Gos : ')) n = int(input('Enter n : ')) def E_erlang(Gos, A0): a=0 b=n c=0 while abs(a-b)>0.000001: c=(a+b)/2 Gos_c=Gos_erlang(c,n) if Gos_c<Gos: a=c else: b=c return Gos_c print('Capacity :', c)