Python Forum
create new variable that sums the array
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
create new variable that sums the array
#1
Hi Folks,

Could you please help me to understand how to create new variable that sums the array

create another variable that sums the array arg_numbers. Finish the line that starts with numbs_sum = by calculating the sum of all of numbers in the argument.

1. numbers = [13, 5102, 45, 2301.40, 203, 1502, 3]

numbers_sum = sum(numbers)
if len(numbers) >= 1:
    print(numbers_sum/len(numbers))
else:
    print(0)
Reply


Messages In This Thread
create new variable that sums the array - by prasanthbab1234 - Sep-25-2020, 09:39 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Newbie here. Create an array from file data? Rayj00 2 1,280 Jan-13-2023, 01:35 PM
Last Post: perfringo
  Python Coding Help: Calculating Sums bperez 9 3,598 Jan-18-2021, 07:25 AM
Last Post: perfringo
  Beginner: Exporting variable/array using OSC rkk16 4 2,462 May-27-2020, 01:08 PM
Last Post: rkk16
  Loop of sums MathFreak 2 2,653 Mar-20-2019, 10:07 PM
Last Post: MathFreak

Forum Jump:

User Panel Messages

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