Need help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 11

Need help

Why does the function on line 91-92 (function attack()) doesn’t work? I don’t understand. I think it is something about where the object is pointing to or something. Please help me!!! https://code.sololearn.com/cNlr9ybMx3zA/?ref=app

30th Jun 2018, 8:06 AM
_F1_
_F1_ - avatar
9 Answers
+ 4
it appears the problem is in use of superclass weapon here is a revision of your code that works : Happy Coding https://code.sololearn.com/crHRZW07YEkU/?ref=app
30th Jun 2018, 9:40 AM
Hamid
Hamid - avatar
+ 11
Mad Max I will answer your bugs: 1. I am a beginner😆😆 2. On SL you can’t do multiple inputs
1st Jul 2018, 1:04 PM
_F1_
_F1_ - avatar
+ 9
Hamid okay thank you for your help
30th Jun 2018, 8:10 PM
_F1_
_F1_ - avatar
+ 9
Hamid i have also found a bug by myself in the reset() function. range(len(yours)) must be range(len(yours)-1)
1st Jul 2018, 10:46 AM
_F1_
_F1_ - avatar
+ 8
Hamid What changes did you make
30th Jun 2018, 2:12 PM
_F1_
_F1_ - avatar
+ 3
It's a nice game... found few bugs: 1. like your input statement is messed up 2. your game ends after one input... not a very good design...needs to be more interactive... nothing wrong with the Class structure... overall if you can fix them... it'd be a fun game...
1st Jul 2018, 12:56 PM
Mad Max
Mad Max - avatar
+ 2
if u use super class u can define all methods and class variables there and just define individual variables in subclasses; or like I changed it with no super ;individual classes defined with identically named functions are defined. Happy Coding
30th Jun 2018, 4:04 PM
Hamid
Hamid - avatar
+ 2
it was nothing by the way I forgot to make my revised code public.😄 Now u can have a look if u like! Happy Coding
1st Jul 2018, 2:46 AM
Hamid
Hamid - avatar
+ 2
yes... got to know lately :p
1st Jul 2018, 1:45 PM
Mad Max
Mad Max - avatar