2017-04-06 19 views
1
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

請修復您的格式。最簡單的方法是直接從文本編輯器複製並粘貼,然後突出顯示該文本並按下cltr-k –

回答

0

我認爲你遇到的問題是太多的論點,你想要做的就是讓它數學作業,我相信。

第10行newSuperhero = Superhero("Memphis May", "Teleportation", "Mind control", "Mathematics", "Homework")你有哪些是導致你的問題。將其更改爲:

newSuperhero = Superhero("Memphis May", "Teleportation", "Mind control", "Mathematics homework.")應該可以解決您的問題。

+1

我的老師說我需要使用main方法以外的函數並調用主函數方法。據她說,我沒有這樣做。我甚至不知道她的回答意味着什麼。 – Katherine