0
Why does this code gets no output?
def f(H): X=[2,3,5,7,11,13,17,19,23,29] Y=float(H) Z=float(X[0]) K=[] while Z!=500: if Y/Z !=1: if Y%Z==0: K.append(Z) Y=Y/Z else: Z+=1 else: K.append(1) M=len(K)-1 N=K[0:M] return (1) else: return ("number not valid") f(input("n")) https://code.sololearn.com/c3ghpSa1FW83/?ref=app
3 Answers
+ 4
Because there's no print statement anywhere.
+ 3
You can also print the return value (if there is one) directly:
print(f(input("n")))
0
Then should I asign a variable with f(input("n")) and then print it