Computer Science
What is the problem with the following code fragment?
a = 3
print(a)
b = 4
print(b)
s = a + b
print(s)
Python Funda
49 Likes
Answer
The problem with the above code is inconsistent indentation. The statements
print(a)
, print(b)
, print(s)
are indented but they are not inside a suite. In Python, we cannot indent a statement unless it is inside a suite and we can indent only as much is required.Answered By
18 Likes
Related Questions
What will be the output produced by following code fragment:
first = 2 second = 3 third = first * second print (first, second, third) first = first + second + third third = second * first print (first, second, third)
What will be the output produced by following code fragment:
side = int(input('side') ) #side given as 7 area = side * side print (side, area)
What is the problem with the following code fragment?
name = "Prejith" age = 26 print ("Your name & age are ", name + age)
What is the problem with the following code fragment?
a = 3 s = a + 10 a = "New" q = a / 10