Talk:Statistics/Basic: Difference between revisions

Line 81:
== Bugs in Python Example ==
 
The previous example code had the following bugs
1. Line 36 prints the value of i that was used in a list comprehension (line 35) not the original value of i in the outer loop, so the printed value (in Python 2.7) is the max value not the number of values, e.g. 10^7
 
1.# Line 36 prints the value of i that was used in a list comprehension (line 35) not the original value of i in the outer loop, so the printed value (in Python 2.7) is the max value not the number of values, e.g. 10^7
2.# Runtime exceeds 2 minutes on a MacBook Pro. Probably not suitable for an example
 
So I reduced the maximum list allocated to 100,000 random values, and added a new index variable, j, to take care of the recycled variable i displaying the wrong value (and hanging the terminal update because the string was 10 MB long).
 
--[[User:Hobs|Hobs]] ([[User talk:Hobs|talk]]) 19:35, 8 April 2013 (UTC)
4

edits