新手問題 AttributeError: 'ElectricCar' object has no attribute 'battery_size'

when I learned the book called ‘Python Crash Course’, I confronted one problem.

I just typed the code as it was in the book, but it didn’t work.
And It showed that "AttributeError: ‘ElectricCar’ object has no attribute ‘battery_size’ "
在這裏插入圖片描述
I was extremely confused about why that was it.

After looking through the same question on the ‘StackOverFlow’, I knew that I spelled the init( ) wrong. I wrote ini( ) but I didn’t realize that at once.

If you are faced up with the same problem with me, please check your code and make sure that there are no spell and indentation mistakes.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章