Oct-01-2017, 06:40 PM
(Oct-01-2017, 05:06 PM)buran Wrote:Oops - yup. Was thinking it too trivial ... but you are right, of course; just because there is an easy way, doesn't mean it isn't useful for learning a simple technique.(Oct-01-2017, 04:36 PM)gruntfutuk Wrote: Isn't that just n(n+1)/2, where n is the number of rows? No loop needed, or am I missing something here?
Maybe that we are in Homework section and most of the time there are specific requirements - use this, don't use that, based on material that has been covered in class/course or what the teacher want to emphasize. Apart from that you are right that it's possible to use formula for sum of arithmetic progression. Not to mention that python hassum
built-in function that can be applied over sequence/range. :-)
I am trying to help you, really, even if it doesn't always seem that way