+ 2

Can Anyone Help? It's Showing Error

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, 4:30 AM
BISHAL MONDAL
BISHAL MONDAL - avatar
5 odpowiedzi
+ 1
The argument of the range function would be an integer, but you passed a float. num = int(input("What is your number: ?")
4th Jan 2022, 4:46 AM
FanYu
FanYu - avatar
+ 1
You forgot the closing parentheses in your float. But float is also incorrect because you are working with prime numbers and therefore should be using int(....) not float(....). You also have improper indentation starting in line 2. python uses indentation to identify code blocks.
4th Jan 2022, 5:44 AM
Paul K Sadler
Paul K Sadler - avatar
+ 1
BISHAL MONDAL Your first line of code is missing a second closing bracket.
5th Jan 2022, 4:59 PM
silentlearner
silentlearner - avatar
0
Then Also It's Showing Error
4th Jan 2022, 5:04 AM
BISHAL MONDAL
BISHAL MONDAL - avatar