Python Forum
making a program for counting
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
making a program for counting
#9
(Oct-01-2017, 05:06 PM)buran Wrote:
(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 has sum built-in function that can be applied over sequence/range. :-)
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.
I am trying to help you, really, even if it doesn't always seem that way
Reply


Messages In This Thread
making a program for counting - by hurmet - Sep-30-2017, 06:16 PM
RE: making a program for counting - by ichabod801 - Sep-30-2017, 07:06 PM
RE: making a program for counting - by hurmet - Sep-30-2017, 07:14 PM
RE: making a program for counting - by ichabod801 - Sep-30-2017, 07:22 PM
RE: making a program for counting - by buran - Sep-30-2017, 07:25 PM
RE: making a program for counting - by hurmet - Sep-30-2017, 07:54 PM
RE: making a program for counting - by gruntfutuk - Oct-01-2017, 04:36 PM
RE: making a program for counting - by buran - Oct-01-2017, 05:06 PM
RE: making a program for counting - by gruntfutuk - Oct-01-2017, 06:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Making maths .py program faster Shutcois 1 2,628 Feb-16-2018, 06:39 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020