I am currently using python3.9
. I have coded a python block of code in which I have put an if else
Condition but when I enter my input such as 15
then both conditions became true like the following. I want to know how an if-else
condition can be true in both case. You can see it in following screenshot so that you can understand well and help me in this.:
x = input("Enter a number: ")
x = int(x)
def my_func(y):
for i in range(1, y):
if y % i == 0:
print("It is consecutive")
elif y < 2:
print("It is smaller than 2")
else:
print("It is prime")
break
my_func(x)