Why does this code gets no output? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

13th Dec 2018, 8:57 PM
albr3cht
albr3cht - avatar
3 Answers
+ 4
Because there's no print statement anywhere.
13th Dec 2018, 9:17 PM
HonFu
HonFu - avatar
+ 3
You can also print the return value (if there is one) directly: print(f(input("n")))
13th Dec 2018, 11:17 PM
HonFu
HonFu - avatar
0
Then should I asign a variable with f(input("n")) and then print it
13th Dec 2018, 9:24 PM
albr3cht
albr3cht - avatar