11.9 LAB: Radioactive decay   Complete the functions in the template to implement the formulas shown below. The formula to calculate how much of a radioactive isotope with half-life T will remain after time t is:   Nt=N0e−0.693tT   The formula can be rearranged to calculate the half-life of an isotope given how much remains after decay:   T=−0.693tlnNtN0   The notation used in the formulas is: e = Euler's number accessible as math.e. t = the length of time (in years) during which an isotope decays T = the half-life (in years) of the isotope N0 = the initial amount of the isotope Nt the amount of the isotope remaining after time t Then, complete the main program to: Read a choice Read 3 numbers from one line: Choice N: N0, t, and T Choice T: N0, Nt, and t Call compute_Nt() if the choice is N, compute_T if the choice is T Output the result with four digits after the decimal point. code I have so far: import math  def compute_Nt(N0, t, T):        return N0 * (math.exp(-0.693*t / T))   def compute_T(N0, Nt, t):        return -0.693 * t / math.log(Nt/N0)   if __name__ == "__main__":      choice = input()   if choice == 'N' :       N0, t, T = map(float, input().split(" "))       Nt = compute_Nt(N0, t, T)       print(f'Nt ={Nt : .4f}' ) elif choice == 'T' :     N0, Nt, t = map(float, input().split(" "))     T = compute_T(N0, Nt, t)     print(f'T ={T: .4f}' ) else:     print("Invalid choice.") error I am getting: 1: Unit testkeyboard_arrow_up 0 / 2 Test compute_Nt(100, 50, 28.94). Should return remaining quantity = 30.2007 (rounded to 4 sig. fig.) 2: Unit testkeyboard_arrow_up 0 / 2 Test compute_T(100, 30.2007, 50). Should return half-life = 28.94 (rounded to 2 sig. fig.)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

11.9 LAB: Radioactive decay

 

Complete the functions in the template to implement the formulas shown below.

The formula to calculate how much of a radioactive isotope with half-life T will remain after time t is:

 

Nt=N0e−0.693tT

 

The formula can be rearranged to calculate the half-life of an isotope given how much remains after decay:

 

T=−0.693tlnNtN0

 

The notation used in the formulas is:

  • e = Euler's number accessible as math.e.
  • t = the length of time (in years) during which an isotope decays
  • T = the half-life (in years) of the isotope
  • N0 = the initial amount of the isotope
  • Nt the amount of the isotope remaining after time t

Then, complete the main program to:

  1. Read a choice
  2. Read 3 numbers from one line:
    • Choice N: N0, t, and T
    • Choice T: N0, Nt, and t
  3. Call compute_Nt() if the choice is N, compute_T if the choice is T
  4. Output the result with four digits after the decimal point.

code I have so far:

import math 


def compute_Nt(N0, t, T):

       return N0 * (math.exp(-0.693*t / T))

 


def compute_T(N0, Nt, t):

       return -0.693 * t / math.log(Nt/N0)

 

if __name__ == "__main__":


     choice = input()

 


if choice == 'N' :

      N0, t, T = map(float, input().split(" "))

      Nt = compute_Nt(N0, t, T)

      print(f'Nt ={Nt : .4f}' )

elif choice == 'T' :

    N0, Nt, t = map(float, input().split(" "))

    T = compute_T(N0, Nt, t)

    print(f'T ={T: .4f}' )

else:

    print("Invalid choice.")

error I am getting:

1: Unit testkeyboard_arrow_up
0 / 2
Test compute_Nt(100, 50, 28.94). Should return remaining quantity = 30.2007 (rounded to 4 sig. fig.)
2: Unit testkeyboard_arrow_up
0 / 2
Test compute_T(100, 30.2007, 50). Should return half-life = 28.94 (rounded to 2 sig. fig.)
 
learn.zybooks.com/zybook/SADDLEBACKCIMP8AVuSummer2022/chapter/11/section/9
My library > CIMP 8A: Programming with Python home >
11.9: LAB: Radioactive decay
Latest submission - 4:35 PM PDT on 07/30/22
= zyBooks
Only show failing tests
1: Unit test ^
2: Unit test ^
Test compute_Nt(100, 50, 28.94). Should return remaining quantity = 30.2007 (rounded to 4 sig. fig.)
Test compute_T(100, 30.2007, 50). Should return half-life = 28.94 (rounded to 2 sig. fig.)
3: Compare output
Input
Your output
4: Compare output
Input
Your output
N
100 50 28.94
Nt = 30.2007
T
100 30.2007 50
T = 28.9400
h
EzyBooks catalog ? Help/FAQ Siyuan Liu
Total score: 6/10
Download this submission
0/2
0/2
2/2
Update
2/2
Transcribed Image Text:learn.zybooks.com/zybook/SADDLEBACKCIMP8AVuSummer2022/chapter/11/section/9 My library > CIMP 8A: Programming with Python home > 11.9: LAB: Radioactive decay Latest submission - 4:35 PM PDT on 07/30/22 = zyBooks Only show failing tests 1: Unit test ^ 2: Unit test ^ Test compute_Nt(100, 50, 28.94). Should return remaining quantity = 30.2007 (rounded to 4 sig. fig.) Test compute_T(100, 30.2007, 50). Should return half-life = 28.94 (rounded to 2 sig. fig.) 3: Compare output Input Your output 4: Compare output Input Your output N 100 50 28.94 Nt = 30.2007 T 100 30.2007 50 T = 28.9400 h EzyBooks catalog ? Help/FAQ Siyuan Liu Total score: 6/10 Download this submission 0/2 0/2 2/2 Update 2/2
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education