![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 06.05.2021 04:30 pishoy9357
PLEASE HELP!!!
I was trying to create a superhero class code, but i ran into this error
File "main. py", line 3
def_init(self, name = "", strengthpts = 0, alterego = "", villain "", powers = "", motto = ""):
IndentationError: expected an indented block
Here is my actual code:
class superhero:
def_init(self, name = "", strengthpts = 0, alterego = "", villain "", powers = "", motto = ""):
# Create a new Superhero with a name and other attributes
self. name = name
self. strengthPts = strengthPts
self. alterego = alterego
self. powers = powers
self. motto = motto
self. villain = villain
def addStrengthPts(self, points):
# Adds points to the superhero's strength.
self. strengthPts = self. strengthPts + points
def addname(self):
if(self. name == "Dr. Cyber"):
print("My hero's name is Dr. cyber!")
elif(self. name == "Mr. cyber"):
print("My hero's name is Mr. cyber!")
elif(self. name == "Cyber Guy"):
print("My hero's name is Cyber Guy!")
else:
print("My hero doesn't have a name")
def addalterego(self):
if(self. alterego == "John Evergreen"):
print("Dr. Cyber's alter ego is John Evergreen")
elif(self. alterego == "John Silversmith"):
print("Dr. Cyber's alter ego is John Silversmith.")
elif(self. alterego == "Johnathen Grey"):
print("Dr. Cyber's alter ego is Johnathen Grey.")
else:
print("Dr. Cyber Does not have an alter ego")
def addpowers(self):
if(self. powers == "flight, super strength, code rewrighting, electronics control, psychic powers"):
print(fly. He is super strong. He can rewrite the genetic code of any object around him to whatever he wants. He can control surrounding electronics to do what he wants. He can move objects with his mind.")
else:
print(Fly. He can rewrite the genetic code of any object around him. he can move objects with his mind.")
def addmotto(self):
if(self. motto == "error terminated!"):
print("rewritting the code!")
else:
print("error eliminated!")
def addvillain(self):
if(self. villain == "The Glitch"):
print("Dr. Cyber's Arch nemisis is The Glitch.")
elif(self. villain == "The Bug"):
print("Dr. Cyber's Arch nemisis is The Bug.")
else:
print("Dr. Cyber has no enemies!")
def main():
newhero = superhero("Dr. Cyber", "John Evergreen", "fly. He is super strong. He can rewrite the genetic code of any object around him to whatever he wants. He can control surrounding electronics to do what he wants. He can move objects with his mind.", "The Glitch", "error terminated!", "0")
print("My Superhero's name is " + newhero. name + ".")
print(newhero. name + "'s alter ego is " + newhero. alterego + ".")
print(newhero. name + " can " + newhero. powers + ".")
print(newhero. name + "'s arch nemisis is " + newhero. villain + ".")
print("when " + newhero. name + " fights " + newhero. villain + ", he lets out his famous motto " + newhero. motto + ".")
print(newhero. name + " defeated " + newhero. villain + ". Hooray!!!")
print(newhero. name + " gains 100 strengthpts.")
main()
PLEASE ONLY SUBMIT THE CORRECT VERSION OF THIS CODE
![ansver](/tpl/images/cats/User.png)
Answers: 3
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 04:30
Which of the statements below is true? the formatting, standard, and drawing commands are unavailable. the formatting, standard, and drawing commands have been used. the formatting, standard, and drawing toolbars are displayed. the formatting, standard, and drawing toolbars are hidden.
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 18:00
Write a method named addall that could be placed inside the hashintset class. this method accepts another hashintset as a parameter and adds all elements from that set into the current set, if they are not already present. for example, if a set s1 contains [1, 2, 3] and another set s2 contains [1, 7, 3, 9], the call of s1.addall(s2); would change s1 to store [1, 2, 3, 7, 9] in some order. you are allowed to call methods on your set and/or the other set. do not modify the set passed in. this method should run in o(n) time where n is the number of elements in the parameter set passed in.
Answers: 2
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 19:50
Which feature is selected to practice and save the timing of a presentation
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 03:30
The footer area of a web page generally houses which website feature? terms of use web page content business name or title menu headings
Answers: 1
You know the right answer?
PLEASE HELP!!!
I was trying to create a superhero class code, but i ran into this error
Questions
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/biologiya.png)
Biology, 05.11.2020 22:40
![question](/tpl/images/cats/mat.png)
Mathematics, 05.11.2020 22:40
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/istoriya.png)
History, 05.11.2020 22:40
![question](/tpl/images/cats/mat.png)
Mathematics, 05.11.2020 22:40
![question](/tpl/images/cats/ap.png)
Advanced Placement (AP), 05.11.2020 22:40
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 05.11.2020 22:40
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/biologiya.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/obshestvoznanie.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 05.11.2020 22:40