def fun(num1,num2):
def deviders(num):
devider_list = []
while num % 2 == 0 and num > 0:
devider_list.append(2)
break
while num % 3 == 0 and num > 0:
devider_list.append(3)
while num % 5 == 0 and num > 0:
devider_list.append(5)
while num % 7 == 0 and num > 0:
devider_list.append(7)
return devider_list()
list_num1 = deviders(num1)
list_num2 = deviders(num2)
return list_num1,list_num2
raw_input4 = 4
raw_input5 = 6
print (fun(raw_input4,raw_input5))
when i run the program nothing gets executed.i dont see why it doesnt return anithing.any idea why?
CodePudding user response:
You've got a couple of issues here...
- You have multiple while loops which do not modify the value of num. Only the first loop actually breaks out if the conditions are met. Modify these to either modify the value of num so it will eventually leave the loop or change the code so you have if statements instead of while loops. Otherwise your application will run infinitely in the while loops without any way of leaving them.
- You're calling decoder_list() in the return statement.
CodePudding user response:
You would have to return decoder_list without ()
