Python Forum
computing average in nested loops
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
computing average in nested loops
#6
Though you get the correct answer for a student's weighed average this is only because the sum of the weights is 1. Try changing your weights to [10, 10, 30, 25, 25]. This should compute the same weighted average as [0.1, 0.1, 0.3, 0.25, 0.25] but it does not when run in your program.

Fixing the above problem should point out the error you are making calculating the classroom average.
Reply


Messages In This Thread
computing average in nested loops - by cap510 - Sep-11-2020, 01:07 AM
RE: computing average in nested loops - by cap510 - Sep-11-2020, 03:42 AM
RE: computing average in nested loops - by buran - Sep-11-2020, 07:03 AM
RE: computing average in nested loops - by deanhystad - Sep-11-2020, 12:33 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with nested loops robert5502001 7 3,732 Aug-01-2022, 06:26 AM
Last Post: stevensanders
  Capitalize first letter of names in nested loops student_of_python 9 4,911 Oct-27-2019, 07:51 AM
Last Post: Larz60+
  nested for loops to recursion ashkea26 4 3,575 Nov-02-2018, 05:00 PM
Last Post: ichabod801
  Computing average vestkok 2 2,575 Aug-12-2018, 10:02 AM
Last Post: vestkok
  Nested loops in openCV JimmyJangle 1 4,886 Apr-17-2018, 04:10 AM
Last Post: Mekire
  Computing factorials Truman 6 4,190 Mar-14-2018, 06:38 AM
Last Post: DeaD_EyE
  Nested for loops with numbers Liquid_Ocelot 7 6,009 Aug-15-2017, 06:38 AM
Last Post: nilamo
  computing the factorial of N foolsgold27 12 8,261 Aug-02-2017, 02:29 AM
Last Post: nilamo
  Nested loops, lists and if statements Liquid_Ocelot 10 9,153 Apr-23-2017, 02:02 PM
Last Post: Mekire

Forum Jump:

User Panel Messages

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