我的FLVS类的类和方法代码存在问题

时间:2017-04-06 23:17:34

标签: python class methods

class Superhero:
    def __init__(self, name = "", specialability = "", adversary = "", impotence = ""):
         # Create a new superhero and give her characteristics.
        self.name = name
        self.specialability = specialability
        self.adversary = adversary
        self.impotence = impotence

def main():
    newSuperhero = Superhero("Memphis May", "Teleportation", "Mind     control", "Mathematics", "Homework")
    print("Allow me to introduce you to my superhero, her name is " + newSuperhero.name)
    print("She is extremely gifted and she was blessed with the following specialability's: " + newSuperhero.specialability)
    print("Yet, she constantly faces her greatest adversary, " +  newSuperhero.adversary)
    print("Unfortunately, her biggest impotence is " + newSuperhero.impotence)

main()

1 个答案:

答案 0 :(得分:0)

我认为你所拥有的问题是太多的争论,你想做的就是让我相信数学作业。

您遇到的第10行newSuperhero = Superhero("Memphis May", "Teleportation", "Mind control", "Mathematics", "Homework")导致您的问题。将其更改为:

newSuperhero = Superhero("Memphis May", "Teleportation", "Mind control", "Mathematics homework.")应解决您的问题。