Python Forum
Error in loops, new to Python
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error in loops, new to Python
#21
For question one, I feel most of those steps are unnecessary as you would get the same answer from some thing like:

list_ = [4.5,6,120.5,9,1,2]
s = sum(list_)
print((s/len(list_)))
I tried to convert the already existing code into a functioning one. Although I didn't know that tiny little tidbit about modifying list while iterating over it :)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  New to python! Loops Seeley307 3 60,410 May-15-2020, 02:27 PM
Last Post: ibreeden
  Python for loops giving error Petrus 12 5,513 Jan-09-2019, 08:02 AM
Last Post: Petrus

Forum Jump:

User Panel Messages

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