Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
While loop/half-life
#1
Carbon-14 is constantly produced in Earth’s upper atmosphere
due to interactions between cosmic rays and nitrogen, and is found in all plants and animals.
After a plant or animal dies, its amount of carbon-14 decreases by about .012%
per year. Determine the half-life of carbon-14, that is, the number of years required for
1 gram of carbon-14 to decay to less than ½ gram

I have to use while statement but I'm not sure how to do that without just using the formula? 
Any tips on the math for this problem?
Reply
#2
What have you tried?
Reply
#3
i wasthnking divide by 0.012%? or keep multplying by 0.0988% in the while loop
Reply
#4
Okay, but what's the condition on the while loop going to be?
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#5
(Mar-06-2017, 02:27 AM)ichabod801 Wrote: Okay, but what's the condition on the while loop going to be?

while (carbon > 0.5)?
Reply
#6
You're going to have to show more than a tentative first line.

while carbon > .5:
    # make some computations
The thing about learning is to try something and see if it works as expected, if it doesn't work, try something else.  Speaking for myself, I have more failures than successes.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#7
(Mar-06-2017, 02:08 PM)sparkz_alot Wrote: Speaking for myself, I have more failures than successes.

100 failures could lead to one success.  ...and, once successful, you stop working.  The default state of any sort of engineering is that failure_count > success_count.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Infinite loop/ only half working anclark686 5 4,745 Sep-09-2018, 07:31 AM
Last Post: buran
  conway's game of life / Single Responsibility Principle hanscvanleeuwen 13 11,063 Dec-17-2016, 08:30 AM
Last Post: hanscvanleeuwen
  conway's game of life hanscvanleeuwen 17 17,759 Dec-09-2016, 04:05 PM
Last Post: hanscvanleeuwen
  Game of life using IDLE Informatics109 4 5,089 Oct-29-2016, 01:39 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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