Question: Q 2 . Create a NEW file with the name part 2 . Copy the content of the source file in Q 1 to
Q Create a NEW file with the name "part Copy the content of the source file in Q to this file. Modify the program developed for Q to perform the following tasks:
Rewrite the function userMenu such that if the user enters r or R it will display "Please enter initial particles mathrmN O : on the screen. The user should input a positive value of type float and you should create a function inputVal to handle this. Then, userMenu will display "Please enter decay constant lambda: on the screen. The user should input a positive value of type float and the function inputVal should be used. Then, userMenu should call a function remainPart which uses the values of N and lambda as input parameters. Function remainPart will display "Please enter time t : on the screen. The user should input a positive value of type float and the function inputVal should be used. Function remainpart will then display the number of remaining particles an integer int using equation and the percentage to decimal places. You may use exp function in the math module. The function remainPart should have no returned value.
Rewrite the function userMenu such that if the user enters h or H it will display "Please enter decay constant lambda: on the screen. The user should input a positive value of type float and the function inputval should be used. Then, userMenu should call a function halflife which uses the value of lambda as input parameter. Function halflife will compute and display the halflife of the element by solving equation Note that the halflife of an element is the time taken so that the number of remaining particles is exactly half the original number, ie it is the time taken for particles to decay out of N particles. You may use log function in the math module. The function halflife should have no returned value. Print the two float outputs to decimal places, assuming that year days.
Rewrite the function userMenu such that if the user enters or it will make use of inputval to get a positive value for lambda instead of asking and checking until getting a positive value as in Q
The sample outputs given below should be realised by your program on executing it inside Jupyter Notebook or under any standard wellknown Python platform. Notice that the characters following a : isare entered by the user.
Find mean lifetime
r Find remaining particles
h Find halfife
f Find best fitting curve from data
q Quit
Please enter your choice r h f or q
to quit: r
Please enter initial particles N:
Input should be positive, please try
again:
Input should be positive, please try
again:
Please enter decay constant lambda:
Please enter time tmathrm:
Remaining particles after years is
Find mean lifetime
r Find remaining particles
h Find halflife
f Find best fitting curve from data
q Quit
Please enter your choice r h f or q
to quit: H
Please enter decay constant lambda:
Input should be positive, please try
again:
Halflife is years days
Find mean lifetime
r Find remaining particles
h Find halflife
f Find best fitting curve from data
q Quit
Please enter your choice r h f or q
to quit: q
Thank you for using our system!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
