The console is saying that “continue” and “break” are not in the loop.
print(f”Prime Number Checker”)
while True:
# Inputs
integer = input(“nEnter an integer to test: “)
# Processes
number = int(integer)
is_prime = True
i = 0
for i in range(2, number-1):
if number % i == 0:
is_prime = False
break
if is_prime:
print(f"{number} is a prime number")
else:
print(f"{number} is a composite number because it is divisible to {i}")
break
else:
print(f”Invalid integer value! Try again”)
continue
option = input(f”Do you want to test another integer (y/n): “)
if option == “n”:
break
Outputs
print(f”Bye!”)
I tried to executed but nothing works.
The console should state this:
Enter an integer to test: 25
25 is a composite number because it is divisible by 5
Do you want to test another integer (y/n): y
Camilla Parson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.