【发布时间】:2020-12-26 03:55:22
【问题描述】:
我正在尝试学习 Python 并且正在运行代码:
for car in cars:
if car == 'bmw':
print(car.upper())
else:
print(car.title())
但我收到此错误:
for car in cars:
... if car == 'bmw':
... print(car.upper())
... else:
File "<stdin>", line 4
else:
^
IndentationError: unexpected indent
知道如何改进代码吗?
【问题讨论】:
-
欢迎来到 StackOverflow。请使用反引号来格式化您的代码。
标签: python-2.7