code show as below:
# -*- coding:gb2312 -*-
# 定义类
class Car:
# 移动
def move(self):
print('车在奔跑...')
# 鸣笛
def toot(self):
print("车在鸣笛...嘟嘟..")
def introduce(self):
print("车的颜色是%s,轮子数量是%d"%(BMW.color,BMW.wheelNum))
# 创建一个对象,并用变量BMW来保存它的引用
BMW = Car()
BMW.color = '黑色'
BMW.wheelNum = 4 #轮子数量
BMW.move()
BMW.toot()
BMW.introduce()
print(BMW.color)
print(BMW.wheelNum)
Results of the:
My question, this error message:
What does inconsistent use of tabs and spaces in indentation mean?
I used Google to translate it, it means:
Inconsistent use of tags and spaces in indentation
The problem is that I checked and can't see any errors.
As shown in the picture, I blocked the wrong line with comments, and the program can run automatically. In other words, other indented lines juxtaposed with the wrong line can run smoothly. So I can't see what's wrong.
# -*- coding:gb2312 -*-
# 定义类
class Car:
# 移动
def move(self):
print('车在奔跑...')
# 鸣笛
def toot(self):
print("车在鸣笛...嘟嘟..")
#def introduce(self): 把错误的地方暂时屏蔽
#print("车的颜色是%s,轮子数量是%d"%(BMW.color,BMW.wheelNum)) 把错误的地方暂时屏蔽
# 创建一个对象,并用变量BMW来保存它的引用
BMW = Car()
BMW.color = '黑色'
BMW.wheelNum = 4 #轮子数量
BMW.move()
BMW.toot()
#BMW.introduce() 把错误的地方暂时屏蔽
print(BMW.color)
print(BMW.wheelNum)
Results of the:
As shown in the picture, I blocked the wrong line with comments, and the program can run automatically. In other words, other indented lines juxtaposed with the wrong line can run smoothly. So I can't see what's wrong.
Don’t use tabs, or set a tab in your editor to 4 spaces. It is recommended to use sublime
I don’t know what editor you are using. If you use sublime, you can see how you indented it