Python Forum
How to find the sum of even numbers from entered N numbers?
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to find the sum of even numbers from entered N numbers?
#3
end = int(input("Give me a number: "))
total = sum(range(0, end+1, 2))
print(total)
idk why you guys are trying to make it so complicated...
Reply


Messages In This Thread
RE: How to find the sum of even numbers from entered N numbers? - by nilamo - Sep-13-2017, 07:19 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python code to calculate mean of an array of numbers using numpy viren 3 147 May-29-2024, 04:49 PM
Last Post: Gribouillis
  How do I calculate a ratio from 2 numbers and return an equivalent list of about 1000 Pleiades 8 15,940 Jan-05-2024, 08:30 PM
Last Post: sgrey
  random numbers, randint janeik 2 642 Nov-27-2023, 05:17 PM
Last Post: janeik
  Advancing Page Numbers knight2000 4 1,090 May-24-2023, 09:14 AM
Last Post: knight2000
  Pulling Specifics Words/Numbers from String bigpapa 2 848 May-01-2023, 07:22 PM
Last Post: bigpapa
  How do I check if the first X characters of a string are numbers? FirstBornAlbratross 6 1,661 Apr-12-2023, 10:39 AM
Last Post: jefsummers
  find random numbers that are = to the first 2 number of a list. Frankduc 23 3,521 Apr-05-2023, 07:36 PM
Last Post: Frankduc
  prime numbers with iterator and generator cametan_001 8 2,003 Dec-17-2022, 02:41 PM
Last Post: cametan_001
  List of random numbers astral_travel 17 2,894 Dec-02-2022, 10:37 PM
Last Post: deanhystad
  Remove numbers from a list menator01 4 1,474 Nov-13-2022, 01:27 AM
Last Post: menator01

Forum Jump:

User Panel Messages

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