{"action":"created","issue":{"url":"https://api.github.com/repos/AllenDowney/ThinkStats2/issues/16","labels_url":"https://api.github.com/repos/AllenDowney/ThinkStats2/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/AllenDowney/ThinkStats2/issues/16/comments","events_url":"https://api.github.com/repos/AllenDowney/ThinkStats2/issues/16/events","html_url":"https://github.com/AllenDowney/ThinkStats2/issues/16","id":58868320,"number":16,"title":"code in book does not seem to work","user":{"login":"flothesof","id":2360669,"avatar_url":"https://avatars.githubusercontent.com/u/2360669?v=3","gravatar_id":"","url":"https://api.github.com/users/flothesof","html_url":"https://github.com/flothesof","followers_url":"https://api.github.com/users/flothesof/followers","following_url":"https://api.github.com/users/flothesof/following{/other_user}","gists_url":"https://api.github.com/users/flothesof/gists{/gist_id}","starred_url":"https://api.github.com/users/flothesof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flothesof/subscriptions","organizations_url":"https://api.github.com/users/flothesof/orgs","repos_url":"https://api.github.com/users/flothesof/repos","events_url":"https://api.github.com/users/flothesof/events{/privacy}","received_events_url":"https://api.github.com/users/flothesof/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2015-02-25T08:40:07Z","updated_at":"2015-03-18T16:49:24Z","closed_at":null,"body":"Hi Allen,\r\n\r\nThanks for your book, it's great.\r\nI executed the code in section 4.2, which reads as follows in your source TeX code:\r\n```\r\n\\begin{verbatim}\r\ndef Percentile2(scores, percentile_rank):\r\n    scores.sort()\r\n    index = percentile_rank * (len(scores)-1) / 100\r\n    return scores[index]\r\n\\end{verbatim}\r\n```\r\n\r\nWhen I executed this \r\n```\r\nscores = [55, 66, 77, 88, 99]\r\nPercentile2(scores, 50.)\r\n``` \r\nI get an error due to the fact that `index` is not an integer, but a floating point value.\r\nI suggest using a cast to int as in \r\n\r\n```\r\ndef Percentile2(scores, percentile_rank):\r\n    scores.sort()\r\n    index = int(percentile_rank * (len(scores)-1) / 100)\r\n    return scores[index]\r\n```\r\n\r\nI guess this solution still needs checking for appropriate rounding..."},"comment":{"url":"https://api.github.com/repos/AllenDowney/ThinkStats2/issues/comments/83054816","html_url":"https://github.com/AllenDowney/ThinkStats2/issues/16#issuecomment-83054816","issue_url":"https://api.github.com/repos/AllenDowney/ThinkStats2/issues/16","id":83054816,"user":{"login":"flothesof","id":2360669,"avatar_url":"https://avatars.githubusercontent.com/u/2360669?v=3","gravatar_id":"","url":"https://api.github.com/users/flothesof","html_url":"https://github.com/flothesof","followers_url":"https://api.github.com/users/flothesof/followers","following_url":"https://api.github.com/users/flothesof/following{/other_user}","gists_url":"https://api.github.com/users/flothesof/gists{/gist_id}","starred_url":"https://api.github.com/users/flothesof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flothesof/subscriptions","organizations_url":"https://api.github.com/users/flothesof/orgs","repos_url":"https://api.github.com/users/flothesof/repos","events_url":"https://api.github.com/users/flothesof/events{/privacy}","received_events_url":"https://api.github.com/users/flothesof/received_events","type":"User","site_admin":false},"created_at":"2015-03-18T16:49:24Z","updated_at":"2015-03-18T16:49:24Z","body":"Hi Allen,\r\n\r\nsmall typo (line 6949 of the TeX source):\r\n\r\nstatistically significant.  But considering the two tests **togther**, I"}}