# 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.

## 382 replies on “A morbid Python script”

1. Fantástico post me gusta el documento apreciar el método que usted describió las cosas, lo hace una gran carrera la mayoría de los otros que usted a través de ese tipo de útiles sitios de información actual de la conciencia para ser capaces de personas vinculadas a muchos puntos. Yo estudio algunos otros sitios web interesantes fuera de sus sitios web, además de mi negocio es mucho dedica la utilización de su capacidad de blogs, mi esposo y yo también empezó a escribir blogs sitios que tipo de hecho guían a todo el mundo.

Like

2. Wolfram Alpha says:

Bobby didn’t simply shun the questions when asked about the Report, rather than seeming to give it even an ounce of credibility. My wife used hers in Paris on a bus one day when a pickpocket had his hand in my pocket and I didn’t notice. (error may be flashing) The paper light should be on or flashing. http://www.hundehaftpflichtberater.com

Like

3. Interesting topic for a blog. I have been searching the Internet for fun and came upon your website. Fabulous post. Thanks a ton for sharing your knowledge!

Like

4. tahirkhan says:

I was very impressed by this post, this site has always been pleasant news Thank you very much for such an interesting post, and I meet them more often then I visited this site. http://www.youtube.com/watch?v=T9CJTsEa4ys

Like

5. tahirkhan says:

I enjoyed reading your post and found it to be informative and to the topic. Thank you for not rambling on and on just to fill the page. Thanks.. how can i make him want me

Like

6. davidlaw says:

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

Like

7. davidlaw says:

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

Like

8. davidlaw says:

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

Like

9. Keep blogging.ur site is good.and finelly ur site going to in high position

Like

10. Wonderful work! This is the kind of info that should be shared around the internet.

Like

11. 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

Like

12. 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

Like

13. carl says:

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.

Like

14. davidlaw says:

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

Like

15. Hepinize bu testin sonra gözbebekleri yıkama gitmek gerekir sanırım!

Like

16. tahirkhan says:

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

Like

17. tahirkhan says:

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

Like

18. This is a great blog posting and very useful.

Like

19. will talk says:

I am new to weblog and definitely liked this blog site. Very likely I’m going to bookmark your blog . You absolutely have wonderful stories. how to hack instagram password

Like

20. davidlaw says:

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

Like

404

Like

Like

23. davidlaw says:

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

Like

24. davidlaw says:

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

Like

25. will talk says:

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

Like

26. In addition to art that will give you good

Like

27. What’s going on with all that spam?

Like

28. Hello , Really appreciate this wonderful post that you have provided for us. 🙂 Best regards.

Like

29. davidlaw says:

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/

Like

30. will talk says:

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

Like

31. k96 says:

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

Like

32. tahirkhan says:

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

Like

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

Like

34. will talk says:

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

Like

35. will talk says:

“We have it arriving from both ways,” Little says. Then there are the substances leaking into the watershed from the unlined ash lake, as well. http://www.247liveshemales.com/

Like

36. will talk says:

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

Like

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

Like

38. Wooooooooow, Great publish i have to admit and thanks for the tips. Thanks

Like

39. will talk says:

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

Like

40. will talk says:

As one of the biggest free gaming websites, we offer new games every day. If you want more information about top 3 new games. click to find out more

Like

41. are some says:

It involved a grainy picture of a deliver in a Japanese individuals harbour plowing through an unimpressive-looking range of breakers. Rae Hoffman

Like

42. ares someaswxz says:

Thank you for posting such a great article! I found your website perfect for my needs. It contains wonderful and helpful posts. next story

Like

43. ares someassssw says:

If there is one thing that we’re really good, it’s helping people get the attention they want on social media. next story

Like

44. ares someassssw says:

Have you ever thought about creating an e-book or guest authoring on other websites. dentist danbury ct

Like

45. ares someassssw says:

Again, a kid with a Happy Meal is getting up useful cafe property. You and your partner fit a two-top. You and your partner and your Happy Meal-toting kid take up a four-top. my response

Like

46. ares someassssw says:

You and your partner and your Happy Meal-toting kid take up a four-top. That’s two chairs the cafe could have provided to two other mature customers purchasing from the selection. http://georgetowndentalspa.com/

Like