Trying to pass value from one function to another
function to input a number
def compute2():
x=input("enter a number")
num=int(x)
print(num)
return num
#function to find primes
def compute1(num):
a = []
for i in range(2,num+1):
for j in range(2,i):
if((i % j) == 0):
break;
else:
a.append(i)
return a
#function for finding lcm
def compute(a):
count=0
b=[]
for i in a:
for j in range(1,20):
if(i**j<20):
count=count+1
b.append(count)
count=0
print(b)
z=1
for x in range(0,8):
z= z * a[x]**b[x]
print(z)
return z
if __name__ == "__main__":
compute2()
compute1(num)
compute(a)
I am getting the error 'num' not defined and 'a' not defined in the main function. I am trying to clear my basics. How to pass the argument and list
num=compute2()you have a return but you don't assign it to variable