Python function to check if a given number is a prime number. ( I NEED HELP) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Python function to check if a given number is a prime number. ( I NEED HELP)

def is_prime(number): aif number <= 1: return False for i in range(2, int(number**0.5) + 1):

1st Feb 2024, 6:46 AM
Code With Nouman
Code With Nouman - avatar
4 Answers
+ 1
remove the ( a ) before if and see the output
1st Feb 2024, 7:23 AM
Mohamed Beder Oumar
Mohamed Beder Oumar - avatar
+ 7
Code With Nouman, your code is incomplete, so please show the complete code. > put your code in playground, save it there, create a link to the code and post this link here
1st Feb 2024, 12:01 PM
Lothar
Lothar - avatar
+ 1
Remove the a before the if and the < before the =
2nd Feb 2024, 11:10 PM
Elikem Foli Botsoe
Elikem Foli Botsoe - avatar
+ 1
def is_prime(number): if number<=1: print ("false") for i in range (2,int(number**0.5)+1): print("true") is_prime(5) Output:- True
3rd Feb 2024, 3:28 AM
Jayashree Meenakshi
Jayashree Meenakshi - avatar