I'm trying to learn Python and I'm running the code:
for car in cars:
if car == 'bmw':
print(car.upper())
else:
print(car.title())
But I'm getting this error:
for car in cars:
... if car == 'bmw':
... print(car.upper())
... else:
File "<stdin>", line 4
else:
^
IndentationError: unexpected indent
How can I improve the code?
else" has actually been indented seven more spaces than the "if", thus causing "IndentationError: unexpected indent". The indentation levels are not required to be consistent.