Nov-17-2020, 09:56 AM
def getFacNumList(n): a=1 index=2 for i in range(n): print(a) a=a*index index+=1 return def dispFecNumList(fList): index=1 for x in range(fList): print(f"n={index} :n!=") index+=1 return dispFecNumList(getFacNumList(8))but the output show
1 2 6 24 120 720 5040 40320 Traceback (most recent call last): File "c:\User\Desktop\python", line 21, in <module> dispFecNumList(getFacNumList(8)) File "c:\Users\Desktop\python", line 15, in dispFecNumList for x in range(fList): TypeError: 'NoneType' object cannot be interpreted as an integerHow can i make the function like
n=1 :n!=1 n=2 :n!=2 n=3 :n!=6 n=4 :n!=24 n=5 :n!=120 n=6 :n!=720 n=7 :n!=5040 n=8 :n!=40320These two functions can work successfully in independence but i don't know how to combine them