Rao has written a code to input a number and check whether it is prime or not. His code is having errors. Rewrite the correct code and underline the corrections made.
def prime():
n=int(input("Enter number to check :: ")
for i in range (2, n//2):
if n%i=0:
print("Number is not prime \n")
break
else:
print("Number is prime \n’)
Answer:
Corrected Code with underlined corrections:
def
prime
():n=int(input(
"Enter number to check :: "
) )for i in range (
2
, n//2
):if n%i = =
0
:print(
"Number is not prime \n"
)break
else:
print(
"Number is prime \n "
)
The corrections are:

In the line,
n=int(input(
"Enter number to check :: "
) ) , the underlined bracket was missing. 
In the line,
if n%i
=
=
0
: , the underlined equal to symbol was missing.  In the line, break , the indentation of break was incorrect.

In the line,
print(
"Number is prime \n "
) , the quotes inside the print( ) did not match.
Get live Maths 1on1 Classs  Class 6 to 12