consider the following function f def f(n): s=0 for i in range(1,n+1): if n%i==0: s=s+1 return(s%2==1)
Answers
Answered by
1
There is a small mistake in the programme i.e I am correcting it and also calling the programme.
Mistake = return(s%2==1)
correct = return(s%2==0)
Programme will be :-
def f(n):
s=0
for i in range(1,n+1):
if n%i==0:
s=s+1
return(s%2==0)
n=int(input("enter any no ")) # extra added
s=f(n) # calling statement
print(s) # printing the result
This programme is of Prime Number
It will return True if the input no. is prime otherwise it will return False
As I call the program so it will also show True and False.
Similar questions