0
What is the mistake in this code?🧐
This code is on the concept object oriented programming i think i done mistake in def royality but i couldn't find. https://code.sololearn.com/cjlsj18Ayr03/?ref=app https://www.sololearn.com/discuss/2154252/?ref=app
34 Réponses
+ 7
Pradeep Singh, please don't drop random comments in other people's questions, if you don't have anything to contribute.
+ 2
Code seems to run.
What exactly is the problem you are having with your code?
In which way is the behavior different to what you expect?
Please give us more details so we can help you!
+ 2
Tell me when you fixed it.
+ 2
Syntax error
+ 2
HonFu now it becoming so fishy, i will try tomorrow 👍
+ 2
New day, new attempt! 👍
+ 2
The call to the class(instance of the class) should stay outside of the class definition. It means:
class Book:
Yourmethods
B=Book()
Added the call to the book. I got error in method showInfo(). Now it should easier for you to fix the errors as you can see the code running.
https://code.sololearn.com/c7TwB3w8GXCo/?ref=app
+ 2
Hmmmm....
+ 1
Bro HonFu see the def royality i apply all the different conditions idea like if condition and by computing on the .get value but i didn't found any solution
+ 1
But your royalty method has no conditions at all in it - it's just straight code, statements from top down!
+ 1
HonFu wait i make changes in code by applying conditions, and also in my laptop i tried the condition on idle
+ 1
Now you have written ifs, but I don't see any indentation.
You did the indentation correctly writing that class though.
How did that happen?
+ 1
No wait, that is not completed
+ 1
HonFu Nothing is fixed,,when i applied change it was showing a new error
+ 1
What was the error?
+ 1
In which line?
+ 1
There are a few errors. Tit in the init method is not defined. As well, there is no instance of the book class, so the code runs without giving any error as it does not run anything
I stopped in the error of the tit that is not defined and it is called in line 2.
Also, I recommend add spaces between =, and class names sould be in capa, Book, and methods cannot use CamelCase that ia reserved dor classes, according to PEP-8.
+ 1
💞💔💞 output royalty
+ 1
GeraltdeRivia ok i will do changes by your said instructions
+ 1
https://code.sololearn.com/cAZjoyDnC6Yl/?ref=app
Fixed few things not all but this should work