Question: Radioactive materials decay over time and turn into other substances. For example, Carbon-14 decays into Nitrogen-14 through beta decay. The rate of radioactive decay

Radioactive materials decay over time and turn into other substances. For example, 

Radioactive materials decay over time and turn into other substances. For example, Carbon-14 decays into Nitrogen-14 through beta decay. The rate of radioactive decay of a material is measured in terms of its half-life. The half-life of a material is defined to be the amount of time it takes for half of the material to undergo radioactive decay. Let m be the initial mass in grams of some material and let h be the material's half-life in days. Then the remaining mass of the material on day t, denoted m(t), is given by the formula: m(t) = m x0.5"h Note: This formula is not a Python assignment statement. It is an equation that says: if you know the quantities m, r, and h, you can calculate a value using the right side of the equation. That value will be the amount of remaining mass of the material after + days. For this question, create a program which does the following: Prompt the user to enter the initial mass of the material (in grams). You must make sure that the user enters a positive number. If they do not enter a positive number, print a message informing them so, and prompt them to enter the initial amount of material again. Keep doing this until they enter a positive number. Prompt the user to enter the half-life of the material (in days). As above, make sure that the user enters a positive number, and if they don't, keep asking until they do. Starting from day 0, output the amount of the material remaining at one-day intervals. Thus, for day 0, day 1, day 2, etc., you should print out the amount of remaining mass according to the above formula. Your program should stop on the first day on which remaining mass is less than 1% of the initial mass. Don't forget to import the math module if you need any non-built-in Python math functions. Hint: You can use two separate while-loops to ensure that the user enters correct values for a) the initial mass and b) the half-life You can also use another while-loop to calculate and display the remaining mass on a daily basis. Test your program with h = 3 and m - 80 and make sure the output is identical to the sample output. Then test your program with h = 2 and m= 100. Make sure the output makes sense! Then test your program once more with inputs of your choice - these should be unique to you and unlikely to be chosen by two different students. Do not use too large a value for h, or your program will produce very long outputs.

Step by Step Solution

3.50 Rating (147 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

PYTHON import math def getpositiveinputprompt while True ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!