Python Forum
[Learning] 3 hours for one simple exercise
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Learning] 3 hours for one simple exercise
#6
(Aug-25-2019, 10:42 AM)perfringo Wrote: There are some ambiguity (what does mean separated by four) but sum of every forth integer in range n should be simply:

>>> n = 100
>>> sum(i ** 2 for i in range(1, n+1, 4))
80825

Can you help me fix the code implementing range as you told me?
If is not much of a problem...
Thanks!
Reply


Messages In This Thread
RE: [Learning] 3 hours for one simple exercise - by KoFu - Aug-25-2019, 07:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Plz help Ive tried for hours and cant do these three problems VB4 1 2,003 Mar-17-2018, 04:59 AM
Last Post: micseydel
  Simple exercise - how to write in python tomtom55 6 5,031 Sep-28-2017, 07:18 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