From cca2ccc2b16f52fc3d33ec2b2e5e62a6df5086b6 Mon Sep 17 00:00:00 2001 From: akshay-gupta123 <56124489+akshay-gupta123@users.noreply.github.com> Date: Sun, 6 Oct 2019 08:44:36 -0700 Subject: [PATCH] update project1 is_prime function is completed --- project1.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/project1.py b/project1.py index e66b77e..a5f21be 100644 --- a/project1.py +++ b/project1.py @@ -4,9 +4,18 @@ def fib(number_for_fibonacci): def is_prime(number_to_check): - # Add code here - # comment added by new user - return #boolean value +prime="True" +flag=1 +for word in range((int(number_to_check))//2-2) : + if int(number_to_check)%int(word+2)==0 : + flag=0 + break +if number_to_check=="1": + print(~prime) +elif flag==1: + print( prime) +else : + print(~prime) def reverse_string(string_to_be_reversed):