+ 3

I wrote following code but it didn't give any results. Can anyone tell me how should I modify it to give out my desired result?

Object-oriented-programming(class) https://code.sololearn.com/cQrQ169sqhz3/?ref=app https://code.sololearn.com/cQrQ169sqhz3/?ref=app

16th Aug 2018, 5:29 PM
Saeed Mozaffari
Saeed Mozaffari - avatar
8 ответов
+ 4
the last line: move print to the left, on the same indentation as the if. nice code by the way
16th Aug 2018, 5:43 PM
davy hermans
davy hermans - avatar
+ 3
i just learned something from your code. I never used yield before. I probably should practice object oriented programming.
16th Aug 2018, 6:05 PM
davy hermans
davy hermans - avatar
+ 3
Saeed Mozaffari i started on sololearn almost 2 years ago. First small things in python, then html, css and JS. Just for fun and to keep up with my students 😄
16th Aug 2018, 6:22 PM
davy hermans
davy hermans - avatar
+ 3
Saeed, can you explain line 10? I know it adds every number to the previous one. I don't get your logic! nice.
16th Aug 2018, 8:16 PM
Iman Rafi
Iman Rafi - avatar
+ 3
Iman Rafi self.a = 0, self.b = 1. self.a + self.b = 0 + 1 = 1, 1+1 = 2, 1 + 2 = 3, 2 + 3 = 5, 3 + 5 = 8, ... when i delete line 10 the code doesn't work.
17th Aug 2018, 3:39 AM
Saeed Mozaffari
Saeed Mozaffari - avatar
+ 1
davy hermans Oh what a stupid i am . I didn't notice that obvious mistake. Thank you any way. Your codes are nicer than mine.😊
16th Aug 2018, 6:02 PM
Saeed Mozaffari
Saeed Mozaffari - avatar
+ 1
davy hermans really? I'm so glad to hear that . I also should practice oop. To be honest, I have had not any experience in programming I just started lesrning a few months ago.
16th Aug 2018, 6:15 PM
Saeed Mozaffari
Saeed Mozaffari - avatar
0
(self.a, self.b) = (self.b, self.a + self.b) always consider slow-witted guys when writing codes 😁
17th Aug 2018, 12:11 PM
Iman Rafi
Iman Rafi - avatar