0
please help me with this ,this program ive written gives no output when i call it. i am a beginner in python so please help me.
7 Respuestas
+ 3
I think it happens because you never call the functions. Call them at the bottom and it should work
+ 3
Your function checkprime() is wrong. It will return True for b = 85. Remove the elif statement from line 16 and return True only if all possible divisors have been checked and no divisors have been found. As it is now, it checks if 85 is divisible by 2 (which is false), then it checks if 85 is NOT divisible by 2 (which is true) and returns True.
+ 2
There's no call to the functions. The 3rd one calls the other two, but nothing calls this third function.
Fixing that, I recommend using an output function (like 'print') to clearly show the user what is the result.
+ 1
no I called it at the bottom.but it is not giving any output.
0
Alpesh_Jamgade
try doing this at the bottom of ur code without indentation
print(f(8))
print(checkprime(9))
print(hprime(8))
0
As others have said, you're missing a function call outside of your defined functions. Remember defining a function and calling a function are two different things. It's like writing an email and forgetting to press send... sort of.
0
anna, check this out..
https://code.sololearn.com/ckwU66wG0Vij/?ref=app