Home > other >  Pure white, how should solve
Pure white, how should solve

Time:10-10

The class ParentClass1:
Def__init__ (self, name, age) :
The self. The name=name
The self. The age=age
Def the speak (self) :
Print (' speak ParentClass1)
The class SubClass1 (ParentClass1) :
Def__init__ (self, name, age, county) :
ParentClass1. __init__ (self, name, age)
The self. The county=county
Def write (self) :
Print (' write SubClass1 ')
Ask why always run after expected an indented block
Pure white, consult

CodePudding user response:

Every error message appear after the English word "indented", shows the indentation error,
Don't know what do you use ide or editor, the reason is probably the last TAB or the blank space key combination, caused by the inconsistent indentation,

The solution:
select the first block of code, use shortcuts left mobile, then indentation, right

CodePudding user response:

 class ParentClass1: 
Def __init__ (self, name, age) :
The self. The name=name
The self. The age=age

Def the speak (self) :
Print (' speak ParentClass1 ')

The class SubClass1 (ParentClass1) :
Def __init__ (self, name, age, county) :
ParentClass1. __init__ (self, name, age)
The self. The county=county

Def write (self) :
Print (' write SubClass1 ')


You carefully look at, you behind the main problem is def no Spaces, print (' speak ParentClass1) less quotes, indentation, namely again see you,

CodePudding user response:

Indented, ragged, serrated, which means that the indentation of your code appear problem,
  • Related