A morbid Python script

Comics #493 and #893 involve actuarial tables, which are tables for calculating the probability that someone of a given age will die within a given amount of time.

One evening, when I was feeling morbid, I wrote a Python script to calculate death probabilities for any collection of people: actuary.py (.txt). It takes a list of ages and genders and produces various statistics. Here’s the report for the nine living people who have walked on the moon:

~$ python actuary.py 81m 82m 80m 81m 80m 81m 76m 78m 77m
There is a 5% chance of someone dying within 0.08 years (by 2012).
There is a 50% chance of someone dying within 1.1 years (by 2013).
There is a 95% chance of someone dying within 4.08 years (by 2016).

There is a 5% chance of everyone dying within 10.78 years (by 2023).
There is a 50% chance of everyone dying within 16.12 years (by 2028).
There is a 95% chance of everyone dying within 22.57 years (by 2035).

Probability of all dying in 1.0 year: <0.001%
Probability of a death within 1.0 year: 46.32%

And here’s the table for four of the main stars of the original Star Wars (Harrison Ford, Carrie Fisher, Mark Hammill, James Earl Jones):

~$ python actuary.py 69m 55f 60m 81m 10
There is a 5%  chance of someone dying within 0.42 years (by 2012).
There is a 50% chance of someone dying within 4.74 years (by 2017).
There is a 95% chance of someone dying within 12.83 years (by 2025).

There is a 5%  chance of everyone dying within 18.17 years (by 2030).
There is a 50% chance of everyone dying within 31.28 years (by 2043).
There is a 95% chance of everyone dying within 42.62 years (by 2055).

Probability of all dying in 10.0 years:   0.272%
Probability of a death within 10.0 years: 85.94%

Of course, these are based on average death rates based only on age and gender. Adding more specific information about the people in question will refine the calculation. For example, I’d guess former astronauts are more likely to be in good health—and have longer life expectancies—than the rest of us.

291 thoughts on “A morbid Python script

  1. The is one of Christian’s most popular products that helps men not only find and attract amazing women, but ultimately turn them into loving, loyal, and long-lasting girlfriends… amway opinie

  2. Great post i must say and thanks for the information. Education is definitely a sticky subject. However, is still among the leading topics of our time amway polska

  3. Great post! I am actually getting ready to across this information, is very helpful my friend. Also great blog here with all of the valuable information you have. Keep up the good work you are doing here. słoiczki gerber

  4. This is a nice content with lots of information. It’s a very excellent idea for raising money for charity. I think honest review is more important for authors. I like your whole discussion. Keep it up.
    Keep blogging.ur site is good.and finelly ur site going to in high position

  5. Este artículo tiene todo! Estoy construyendo un nuevo proyecto con algunos de mis colegas y yo en serio necesitaba algo de información que podría tener el proyecto en marcha. Gracias a ti he descubierto que la información

  6. So many blog comments are bit droppings. Thanks for xkcd, it touches people. Some people tag their lives with xkcd numbers, and their friends understand (I have to consult the source). Many thanks. When I think if something clever enough for xkcd, i’ll send it to you.

  7. Looks cool, I never knew you could post about it, good to know thanks! You show very latest and important things. This is very nice post! I will bookmark this blog hemorrhoid no more

  8. This is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more … good luck my thoughts

  9. This is a really good post this. Truly, a magnificent art is making an article. And you are quite a master at that art. I would tell you to keep on continuing this awesome work of yours 60 second panic solution

  10. Great post! I am actually getting ready to across this information, is very helpful my friend. Also great blog here with all of the valuable information you have. Keep up the good work you are doing here. my review

  11. Really appreciate this wonderful post that you have provided for us.Great site and a great topic as well i really get amazed to read this. Its really good cosplay

  12. Your fabulous machine contains a stunning content and intensely necessary knowledge that provide tree State new issue to explore in my project. I found what i truly demanded. storage units Menifee CA

  13. He took her home to his room, but they woke up in the same clothes they fell asleep in. I haven’t seen the movie in a number of years, but I think they’re right—and bit of Googling suggests that I’m not the only one who was confused on that point. htc one m8 covers

  14. I am very happy to read this. This is the kind of manual that needs to be given and not the random misinformation t hat’s at the other blogs. Appreciate your sharing this best posting. http://www.ge.tt/

  15. I experience bad for children known as Something Jr, or Something II/III. Give children their own names. chin

  16. Umm, it looks like those links to actuary.py are broken – it throws 404…

  17. Great publish i have to admit and thanks for the tips. Education is certainly a sticky subject. However, continues to be one of the leading subjects in our time. I thank you for publish and anticipate more. how to attract your ex back

  18. What other contractor can say they were involved in the design process of an all-electric service vehicle? Not many! Robichaud is a great example of a contractor on the cutting-edge of technology. Expensive Handbags

  19. Is very helpful my friend. Also great blog here with all of the valuable information you have. Keep up the good work you are doing here. Marreena

  20. My recommendation, if you have this printer, is to research all the tricks to fool the printer into using the toner that is left in the cartridge, and to have an extra brand new cartridge waiting for the “emergency” when it quits using what’s left. next story

  21. Ahaa, its pleasant discussion concerning this paragraph here at this website,
    I have read all that, soo at this time me also commenting at this place. address

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>