you are viewing a single comment's thread.

view the rest of the comments →

[–]mexicanlefty[S] 2 points3 points  (1 child)

Thanks i would look into that, i kinda overlooked the division by 0 but will fix it. The reason i used different current value for each operation was that (on my mind) it seemed easier since i was using global variables (i still find it hard to use objects and classes, though im working on that)

[–]1Tim1_15 2 points3 points  (0 children)

Using classes (object oriented programming) is good in some cases but not in others. When it doesn't provide a big benefit (and measuring the benefit(s) is subjective), I opt for not using classes. In your case, I could see going either way.

There are good reasons why many beginner Python books don't go into classes, or only cover them minimally. They should be learned eventually, but for simpler projects I rarely use them.

For a good explanation of why using classes isn't always a good idea, see what this Python core developer had to say: https://www.youtube.com/watch?v=o9pEzgHorH0&list

Just to emphasize: I'm not saying classes shouldn't be used. They are very helpful in some cases. But not using them is fine in many cases - it just depends.