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

1st Feb 2020, 6:30 PM
Utsav Singh
Utsav Singh - avatar
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.
3rd Feb 2020, 9:34 AM
HonFu
HonFu - avatar
+ 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!
1st Feb 2020, 6:36 PM
HonFu
HonFu - avatar
+ 2
Tell me when you fixed it.
1st Feb 2020, 7:39 PM
HonFu
HonFu - avatar
+ 2
Syntax error
1st Feb 2020, 8:20 PM
Utsav Singh
Utsav Singh - avatar
+ 2
HonFu now it becoming so fishy, i will try tomorrow 👍
1st Feb 2020, 8:25 PM
Utsav Singh
Utsav Singh - avatar
+ 2
New day, new attempt! 👍
1st Feb 2020, 8:37 PM
HonFu
HonFu - avatar
+ 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
3rd Feb 2020, 5:58 AM
GeraltdeRivia
+ 2
Hmmmm....
3rd Feb 2020, 9:31 AM
Ahmad Raisul Siddiq
Ahmad Raisul Siddiq - avatar
+ 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
1st Feb 2020, 6:40 PM
Utsav Singh
Utsav Singh - avatar
+ 1
But your royalty method has no conditions at all in it - it's just straight code, statements from top down!
1st Feb 2020, 6:45 PM
HonFu
HonFu - avatar
+ 1
HonFu wait i make changes in code by applying conditions, and also in my laptop i tried the condition on idle
1st Feb 2020, 7:32 PM
Utsav Singh
Utsav Singh - avatar
+ 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?
1st Feb 2020, 7:34 PM
HonFu
HonFu - avatar
+ 1
No wait, that is not completed
1st Feb 2020, 7:35 PM
Utsav Singh
Utsav Singh - avatar
+ 1
HonFu Nothing is fixed,,when i applied change it was showing a new error
1st Feb 2020, 8:19 PM
Utsav Singh
Utsav Singh - avatar
+ 1
What was the error?
1st Feb 2020, 8:19 PM
HonFu
HonFu - avatar
+ 1
In which line?
1st Feb 2020, 8:21 PM
HonFu
HonFu - avatar
+ 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.
3rd Feb 2020, 1:28 AM
GeraltdeRivia
+ 1
💞💔💞 output royalty
3rd Feb 2020, 2:25 AM
Utsav Singh
Utsav Singh - avatar
+ 1
GeraltdeRivia ok i will do changes by your said instructions
3rd Feb 2020, 2:27 AM
Utsav Singh
Utsav Singh - avatar
+ 1
https://code.sololearn.com/cAZjoyDnC6Yl/?ref=app Fixed few things not all but this should work
3rd Feb 2020, 3:05 AM
aleksandar tadic
aleksandar tadic - avatar