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. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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.

https://code.sololearn.com/cA0lh6ftOj4F/?ref=app

2nd Sep 2018, 3:08 PM
Alpesh_Jamgade
Alpesh_Jamgade - avatar
7 Answers
+ 3
I think it happens because you never call the functions. Call them at the bottom and it should work
2nd Sep 2018, 3:11 PM
Jishu🎗💛
Jishu🎗💛 - avatar
+ 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.
2nd Sep 2018, 7:53 PM
Anna
Anna - avatar
+ 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.
2nd Sep 2018, 3:46 PM
Emerson Prado
Emerson Prado - avatar
+ 1
no I called it at the bottom.but it is not giving any output.
2nd Sep 2018, 3:33 PM
Alpesh_Jamgade
Alpesh_Jamgade - avatar
0
Alpesh_Jamgade try doing this at the bottom of ur code without indentation print(f(8)) print(checkprime(9)) print(hprime(8))
2nd Sep 2018, 7:14 PM
E_E Mopho
E_E Mopho - avatar
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.
2nd Sep 2018, 10:17 PM
benjamin
7th Sep 2018, 5:15 PM
Alpesh_Jamgade
Alpesh_Jamgade - avatar