24. Find out the error(s) in the following code fragments:
(1) temperature = 90
Print temperature
(2) a = 30
b = a + b
print (a And b)
(3) a, b, c = 2, 8, 9
print (a, b, c)
c, b, a + a, b, c
print (a ; b ; c)
(4) x = 24
4 = x
(5) Print("X =" X)
please give me answer in few minutes
Answers
Answered by
41
Answer:
i)
temperature = 90
print temperature # print() is a function and parentheses must be used in python3
ii)
a = 30
b = a + b # b is not defined
print(a And b) # And should be written as and
iii)
a, b, c = 2, 8, 9
print(a, b, c)
c, b, a = a, b, c
print(a;b;c) # ',' should be used instead of ';'
iv)
X = 24
4 = X # Incorrect assignment, Variables are Rvalues
v)
print("X="X) # A ',' should be used between the string and variable
vi)
else = 21-5 # else is a keyword and can't be used a variable
Similar questions