Answer to Question #224609 in Python for Hari nadh babu

Question #224609
num = int(input())
if num > 1:
  for i in range(2, int(num/2)+1):
    if (num % i) == 0:
      print(True)
      break
  else:
    print(False)
  
else:
  print(True)

In this python program it has three test cases, in this three test cases two test cases are getting expected output and third test case are not getting expected output. Please give me expexted output for three test cases. Thank you !

Question url :-

https://drive.google.com/file/d/1XrSRAXys8kKSTYMSm58aED455XD_i4tm/view?usp=sharing


Test case - 1 

Input

12

Output

True

 

Test case - 2

Input

3

Output

False

 

Test case - 3

Input

1

Output

False


1
Expert's answer
2021-08-11T14:12:55-0400
num = int(input())
f = False


if num > 1:
    for i in range(2, num):
        if (num % i) == 0:
            f = True
            break


if f:
    print("True")
else:
    print("False")

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS