# 15+ Best Error Finding Questions (Solved) in Python

Share with others

## Python Error Finding Questions – Test 1

Q1. Find error(s) in the following code(if any) and rewrite code and underline each correction:

```x= int(“Enter value of x:”)
for in range [0,10]:
if x=y
print("They are equal")
else:
Print( "They are unequal")```
```Show AnswerAns.

x= int(input(“Enter value of x:”))
for y in range (0,10):
if x==y:
print("They are equal")
else:
print( "They are unequal")```

Q2. Find error(s) in the following code(if any) and rewrite code and underline each correction.

```a, b = 0
if (a = b)
a +b = c
print( z)```
```Show AnswerAns.

a= b = 0
if (a == b):
c = a + b
print( c)```

Q3. Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code.

```A = int(input("Enter any number:"))
Ar = 0
for x in range(0,A,2)
Ar+=x
if x%2=0:
Print (x*10)
Else:
print (C)
print (Ar)```
```Show AnswerAns.

A = int(input("Enter any number:"))
Ar = 0
for x in range(0,A,2):
Ar+=x
if x%2==0:
print (x+2)
else:
print (x)
print (Ar)```

Q4. Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code.

`fee=2500 = iwhile fee=<2000:      if fee<=750:            print (fee)            fee =+ 250      else:            print( "fee"*i)            i=i+1            fee=Fee+250`
```Show AnswerAns.
fee=250
i=0
while fee<=2000:
if fee<=750:
print (fee)
fee += 250
else:
print( "fee"*i)
i=i+1
fee=fee+250```

Q5. Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code.

```10 = step
for e in the range(0 , step):
If e%2==0:
print(e + 1)
else:
print(e - 1```
```Show AnswerAns.

step = 10
for e in range(0 , step):
if e%2==0:
print(e + 1)
else:
print(e - 1)```

## Python Error Finding Questions – Test 2

Q6. Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code.

```str = "Welcome to my Blog
for S in range[3,9]
Print (str(S))```
```Show AnswerAns.

str = "Welcome to my Blog"
for S in range(3,9):
print (str[S])```

Q7. Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code.

```For i in Range(10):
if(i==5)
break:
else:
print(i)
continue```
```Show Answerfor i in range(10):
if(i==5):
break
else:
print(i)
continue```

Q8. Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code.

```a = input("Enter any number")
if a%2=0:
print("Even number)
Else
print("Odd number")```
```Show AnswerAns.

a = int(input("Enter any number"))
if a%2==0:
print("Even number")
else:
print("Odd number")```

Q9. Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code.

```a = int(Input("Enter any number"))
b = int(input("Enter any number"))
if a=>b:
print("First number is greater"))
else:
Print("Second number is greater")```
```Show AnswerAns.
a = int(input("Enter any number"))
b = int(input("Enter any number"))
if a>=b:
print("First number is greater")
else:
print("Second number is greater")```

Q10. Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code.

```a = int{input("Enter any number")}
for i IN range(1:11):
print(a," * " , i , " = ", a*i)```
```Show AnswerAns.
a = int(input("Enter any number"))
for i in range(1,11):
print(a," * " , i , " = ", a*i)```

## Python Error Finding Questions – Test 3

Q11. Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code

```def sum(c)
s = 0
for i in Range(1, c+1)
s=s+i
return s
print(sum(5)```
```Show AnswerAns:

def sum(c):
s = 0
for i in range(1, c+1):
s=s+i
return s
print(sum(5))```

Q12. Rectify the errors in the following statements:

```1. Print("Anuj")
2. For i in range(2,4):
3. for i in Range(3,9):
4. def title( )
5. if i =< 5```
```Show AnswerAns:

1. print("Anuj")
2. for i in range(2,4):
3. for i in range(3,9):
4. def title( ):
5. if i <= 5```

Q13. Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code

```N=int(input("Enter any Number:"))
S = 0
for i in range(1,N,2)
s += 1
if i%2=0:
print("i" * 2)
else:
print("i" * 3)
print[S]```
```Show AnswerAns:

N=int(input("Enter any Number:"))
S = 0
for i in range(1,N,2):
S += 1
if i%2==0:
print("i" * 2)
else:
print("i" * 3)
print(S)```

Q14. Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code.

```L = [1,2,3,4,5,6,7,'a','e'
for i in L:
if i==a
break:
else:
print("A")```
```Show AnswerAns:

L = [1,2,3,4,5,6,7,'a','e']
for i in L:
if i=='a':
break
else:
print("A")```

Q15. Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code.

```a = {'6' : "Amit", '2' : "Sunil" : '3' : "Naina"}
for i in a:
if int(i)%3=0
print(a(i))```
```Show AnswerAns:

a = {'6' : "Amit", '2' : "Sunil", '3' : "Naina"}
for i in a:
if int(i)%3==0:
print(a[i])```