Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

LOGICAL TEST – IDENTIFY THE ERRORS AND FIX THEM

You should fix at least 6 programs.

1) Identify 2 errors

if 5 > 2

print("Five is greater than two!")

2) Identify 3 errors

x-z = 5

2y = "John

print(type(y))

3)Identify 1 error.

x, y, z= "green","yellow"

print(x)

print(y)

print(z)

4)Identify 1 error. (Program to convert integer to string)

p = string(5)

print(type(p))

5) Identify 2 errors. (Program to concatenate such that 58+10 = 5810)

x = 58

y = 10

a=x+y

print(a)

6) Identify 2 errors. (Program to print numbers from 1 to 5)

for x in range(1, 6)

print(x)
LOGICAL TEST – IDENTIFY THE ERRORS AND FIX THEM

7) Identify 1 error. (Program to convert the given text to lower case)

a= "Hello my FRIENDS"

x = a.lowr()

print(x)

8)Change the following code , such that the output will be John#Peter#Vicky

a = ("John", "Peter", "Vicky")

x = " ".join(a)

print(x)

9) ) Identify 1 error. (Program to count the number of times apples appear in the statement)

a= "I love apples, apples are my favourite fruit"

x = a.count("apples)

print(x)

10) ) Identify 1 error. ( Program to print numbers from 1 to 5 using while loop.)

i=1

while i < 6:

print(i)

i = i + 1:

You might also like