0

Can Anyone Help It's Showing Error In 2nd Line

num = float(input("What is your number: ?")) for i in range(2, num): if (num % i) == 0: print("This number is not prime") else: print("This number is prime")

4th Jan 2022, 5:05 AM
BISHAL MONDAL
BISHAL MONDAL - avatar
2 Respostas
0
BISHAL MONDAL You forgot to close the bracket in line1
4th Jan 2022, 5:09 AM
NEZ
NEZ - avatar
0
you did not close the parenthesis for float(input()... and you should be casting it as an integer if you are using it for range so: num = int(input()) But these are technical details, the result you get is still not very useful. Run the code and see... you could put break at the end of both the if and the else statements.
4th Jan 2022, 5:11 AM
Bob_Li
Bob_Li - avatar