Question: When using this code, regardless of the number used as the input when 'return False' is indented further than 'return True' all numbers receive the

When using this code, regardless of the number used as the inputwhen 'return False' is indented further than 'return True' all numbers receiveWhen using this code, regardless of the number used as the input when 'return False' is indented further than 'return True' all numbers receive the output of "it is prime", when the 'return True' line is indented the same amount as 'return False' then all numbers regardless of value receive the output of "it is not prime". What did I do wrong?

A number n is prime if it is divisible by another number between 2 to n-1 Divisible also means there is no remainder. You are to determine if a number is prime. If the number entered is prime, print "prime". If the number entered is not prime, print "not prime". You may assume the value entered is between 2 and 1000 inclusive. 373527845385.cxqy/ LAB ACTIVITY 5.21.1: Is it Prime 0/5 main.py Load default template... 1 n int(input) main.py Load default template... 1 n = int(input()) 2 def prime(n): 3 for i in range (2, int(n-1)): 4 if n%2==0: 5 return false 6 return True 7 a=prime (59) 8 if a==True: 9 print("it is prime") 10 else: 11 print("It is not prime")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!