Home > other >  Help me modify the mistake
Help me modify the mistake

Time:09-30

Import the gao
The class person () :
Def __init__ (self, name, age, sex)
The self. The name=name
The self. The age=age
Self. Sex sex of=
The class Student (person) :
Def __init__ (self, name, age, sex, major) :
Person. __init__ (self, name, age, sex)
The self. The major=major
Def show_name (self, name) :
Print (name)
Def show_age (self, age) :
Print (age)
Def show_sex (self, sex) :
Print (sex)
Def show_major (self, major) :
Print (major)
Def dumps_inrdo (self) :
The introduction=[self. Name, slef. The age, the self. The sex, the self. The major]
Print (the introduction)
Return jison. Dumps (the introduction)
A=Student (" gs ", 14 "NAN", "JSJ")
Print (a. d. umps_inrdo ())

CodePudding user response:

 import json 
The class Person () :
Def __init__ (self, name, age, sex) :
The self. The name=name
The self. The age=age
Self. Sex sex of=
The class Student (Person) :
Def __init__ (self, name, age, sex, major) :
Person. __init__ (self, name, age, sex)
The self. The major=major
Def show_name (self, name) :
Print (name)
Def show_age (self, age) :
Print (age)
Def show_sex (self, sex) :
Print (sex)
Def show_major (self, major) :
Print (major)
Def dumps_inrdo (self) :
The introduction=[self. The name, the self. The age, the self. The sex, the self. The major]
Print (the introduction)
Return a json. Dumps (the introduction)
A=Student (" gs ", 14 "NAN", "JSJ")
Print (a. d. umps_inrdo ())
  • Related