\[ \begin{align}\begin{aligned}\newcommand\blank{~\underline{\hspace{1.2cm}}~}\\% Bold symbols (vectors) \newcommand\bs[1]{\mathbf{#1}}\\% Differential \newcommand\dd[2][]{\mathrm{d}^{#1}{#2}} % use as \dd, \dd{x}, or \dd[2]{x}\\% Poor man's siunitx \newcommand\unit[1]{\mathrm{#1}} \newcommand\num[1]{#1} \newcommand\qty[2]{#1~\unit{#2}}\\\newcommand\per{/} \newcommand\squared{{}^2} \newcommand\cubed{{}^3} % % Scale \newcommand\milli{\unit{m}} \newcommand\centi{\unit{c}} \newcommand\kilo{\unit{k}} \newcommand\mega{\unit{M}} % % Percent \newcommand\percent{\unit{{\kern-4mu}\%}} % % Angle \newcommand\radian{\unit{rad}} \newcommand\degree{\unit{{\kern-4mu}^\circ}} % % Time \newcommand\second{\unit{s}} \newcommand\s{\second} \newcommand\minute{\unit{min}} \newcommand\hour{\unit{h}} % % Distance \newcommand\meter{\unit{m}} \newcommand\m{\meter} \newcommand\inch{\unit{in}} \newcommand\foot{\unit{ft}} % % Force \newcommand\newton{\unit{N}} \newcommand\kip{\unit{kip}} % kilopound in "freedom" units - edit made by Sri % % Mass \newcommand\gram{\unit{g}} \newcommand\g{\gram} \newcommand\kilogram{\unit{kg}} \newcommand\kg{\kilogram} \newcommand\grain{\unit{grain}} \newcommand\ounce{\unit{oz}} % % Temperature \newcommand\kelvin{\unit{K}} \newcommand\K{\kelvin} \newcommand\celsius{\unit{{}^\circ C}} \newcommand\C{\celsius} \newcommand\fahrenheit{\unit{{}^\circ F}} \newcommand\F{\fahrenheit} % % Area \newcommand\sqft{\unit{sq\,\foot}} % square foot % % Volume \newcommand\liter{\unit{L}} \newcommand\gallon{\unit{gal}} % % Frequency \newcommand\hertz{\unit{Hz}} \newcommand\rpm{\unit{rpm}} % % Voltage \newcommand\volt{\unit{V}} \newcommand\V{\volt} \newcommand\millivolt{\milli\volt} \newcommand\mV{\milli\volt} \newcommand\kilovolt{\kilo\volt} \newcommand\kV{\kilo\volt} % % Current \newcommand\ampere{\unit{A}} \newcommand\A{\ampere} \newcommand\milliampereA{\milli\ampere} \newcommand\mA{\milli\ampere} \newcommand\kiloampereA{\kilo\ampere} \newcommand\kA{\kilo\ampere} % % Resistance \newcommand\ohm{\Omega} \newcommand\milliohm{\milli\ohm} \newcommand\kiloohm{\kilo\ohm} % correct SI spelling \newcommand\kilohm{\kilo\ohm} % "American" spelling used in siunitx \newcommand\megaohm{\mega\ohm} % correct SI spelling \newcommand\megohm{\mega\ohm} % "American" spelling used in siunitx % % Capacitance \newcommand\farad{\unit{F}} \newcommand\F{\farad} \newcommand\microfarad{\micro\farad} \newcommand\muF{\micro\farad} % % Inductance \newcommand\henry{\unit{H}} \newcommand\H{\henry} \newcommand\millihenry{\milli\henry} \newcommand\mH{\milli\henry} % % Power \newcommand\watt{\unit{W}} \newcommand\W{\watt} \newcommand\milliwatt{\milli\watt} \newcommand\mW{\milli\watt} \newcommand\kilowatt{\kilo\watt} \newcommand\kW{\kilo\watt} % % Energy \newcommand\joule{\unit{J}} \newcommand\J{\joule} % % Composite units % % Torque \newcommand\ozin{\unit{\ounce}\,\unit{in}} \newcommand\newtonmeter{\unit{\newton\,\meter}} % % Pressure \newcommand\psf{\unit{psf}} % pounds per square foot \newcommand\pcf{\unit{pcf}} % pounds per cubic foot \newcommand\pascal{\unit{Pa}} \newcommand\Pa{\pascal} \newcommand\ksi{\unit{ksi}} % kilopound per square inch % NOTE: do NOT define \bar -- it is the built-in LaTeX accent used by \bar{x}, % \bar{y} (sample means). Redefining it made those render as the word "bar". \newcommand\barunit{\unit{bar}} \end{aligned}\end{align} \]

Nov 16, 2026 | 1234 words | 12 min read

8.3.1. PY: Python Foundations#

A biomedical engineering research and development lab is testing a new medical device prototype. You have been assigned to develop a Python program that simulates the testing process, analyzes the resulting test data, and determines whether the prototype passes or fails. You will then summarize your program and results in a professional technical memo.

Required Files#

  1. Download the Python template ENGR131_Python_Template.py and save it as 8_3_1_username.py.

  2. Download the report template, complete it, and save it as 8_3_1_report_username.pdf.

Quick Guide: Completing & Submitting Your Report as PDF

To complete your technical report, you must edit the provided Word template (.docx) and convert it to a PDF for final grading. Follow this simplified workflow:

  1. Edit in Word: Download and open the .docx template in Microsoft Word. Avoid editing in web previewers or Google Docs, as they will corrupt your formulas and chart formatting.

  2. Save as PDF Only When Finished: Type your answers and copy any charts or images directly into the Word document, saving your progress frequently. Once your report is 100% complete, save or export the document as a PDF. (Do not convert to PDF early, as PDFs are static and cannot be edited!) Copy charts or images into the report and keep the originals in the workbook, since Gradescope grades the workbook.

  3. Submit to Gradescope: Upload your finalized PDF and any other required deliverables to the corresponding assignment in Gradescope. Always review your uploaded files from the Gradescope confirmation screen to verify your work is complete.

Reminder

Rename your files with your Purdue username, replacing “template” in the filename. Then fill out any required information in the template such as student name, email, etc.

Task 1: Medical Device Prototype Testing Program#

Your first task is to develop a Python program that collects information about the prototype test, generates simulated test data, performs mathematical analysis, and reports whether the prototype passes or fails.

Reminder

Review and reference the Python Style Guide to create a professionally formatted code file. For example, remember to provide detailed comments throughout your code so anyone can read them and understand what your program does!

User Input#

  • Prompt the user to enter:

    • a random seed integer,

    • the medical device name,

    • the prototype ID number,

    • the researcher’s last name, and

    • the researcher’s title.

  • Store each user input in an appropriately named variable for use throughout your program.

Professional Header#

  • Create and display a clear, professional header containing:

    • the test information provided by the user, and

    • the date and time of the test as a timestamp.

  • Clearly label each piece of information and use appropriate spacing to make the header easy to read.

Hint

We recommend using Python Documentation to learn new things in Python, such as how to print a time stamp.

Simulated Test Data#

  • Initialize the random number generator using the random seed provided by the user.

  • Generate five random integer test values between 5 and 100.

  • Store the five generated test values in a list.

  • Display the test values with an appropriate label.

Mathematical Analysis#

  • Using the list of test values:

    • calculate the average test value, and

    • perform one additional mathematical calculation using one of the following:

      • square root,

      • sine of the average, or

      • a calculation involving pi (\(\pi\))

  • Display the results with appropriate labels.

  • Format all calculated values to two decimal places.

Pass/Fail Evaluation#

  • Determine the status of the medical device using the following criteria:

    • If the average test value is greater than or equal to 50, the device passes.

    • If the average test value is less than 50, the device fails.

  • Display the final pass/fail status with an appropriate label.

Note

Because we have not covered if statements yet in this course, you cannot use an if statement for this part of the assignment.

String Processing and Data Organization#

  • Capitalize the researcher’s last name and researcher’s title when they are displayed.

  • Demonstrate string concatenation using the researcher’s last name in the following form: “lastname_lastname_”.

  • Split the researcher’s title into a list and display the resulting list.

Program Output#

Your final program output must include:

  • a professional header with the test information and timestamp,

  • the five generated test values,

  • the calculated average and additional mathematical calculation,

  • the pass/fail result,

  • the required string processing results, and

  • clean formatting and spacing for readability.

Use the sample output below to verify that your program produces the expected values and follows the required output format.

Note

Use \n to help format your output spacing.

Sample Output#

Use the values in Table 8.3 below to test your program.

Table 8.3 Test Cases#

Case

Seed

Device Name

ID Number

User Last Name

User Title

1

5

Heart Monitor

101

doe

biomedical engineer

2

2

Blood Pressure Monitor

102

smith

senior clinical researcher

Ensure your program’s output matches the provided samples exactly. This includes all characters, white space, and punctuation. In the samples, user input is highlighted like this for clarity, but your program should not highlight user input in this way.

Case 1 Sample Output

$ python3 8_3_1_username.pyEnter random seed (integer): 5Enter medical device name: Heart MonitorEnter prototype ID number: 101Enter researcher's last name: doeEnter researcher's title: biomedical engineer==================================================MEDICAL DEVICE PROTOTYPE TEST REPORT==================================================Device Name : Heart MonitorPrototype ID : 101Researcher : Biomedical Engineer, DoeTest Timestamp : 2026-11-13 10:18:39==================================================Test Values: [84, 37, 99, 50, 93]First Test Value: 84Test Value Slice (3 values): [37, 99, 50]Average Test Value: 72.60Square Root of Average: 8.52Passing Threshold: 50Final Device Status: PASSFormatted Researcher Tag: Doe_Doe_Split Researcher Title Sequence: ['Biomedical', 'Engineer']

Case 2 Sample Output

$ python3 8_3_1_username.pyEnter random seed (integer): 2Enter medical device name: Blood Pressure MonitorEnter prototype ID number: 102Enter researcher's last name: smithEnter researcher's title: senior clinical researcher==================================================MEDICAL DEVICE PROTOTYPE TEST REPORT==================================================Device Name : Blood Pressure MonitorPrototype ID : 102Researcher : Senior Clinical Researcher, SmithTest Timestamp : 2026-11-13 10:18:39==================================================Test Values: [12, 16, 15, 51, 26]First Test Value: 12Test Value Slice (3 values): [16, 15, 51]Average Test Value: 24.00Square Root of Average: 4.90Passing Threshold: 50Final Device Status: FAILFormatted Researcher Tag: Smith_Smith_Split Researcher Title Sequence: ['Senior', 'Clinical', 'Researcher']

Task 2: Medical Device Prototype Testing Report#

After completing and testing your Python program, you will summarize your work and results in a professional technical memo to your laboratory supervisor. Assume your supervisor is scientifically knowledgeable but did not run the program themselves.

Write 1–2 well-structured paragraphs using a clear, professional tone. You may use bullet points to support your discussion, but the entire report should not be organized as a bulleted list.

Purpose of the Program#

  • Explain what the medical device testing program is designed to simulate.

  • Describe the type of data generated by the program and why the data is relevant to evaluating the prototype.

Testing and Analysis Process#

  • Describe how the test values were generated.

  • Explain how the test values were stored and analyzed.

  • Reference specific results from your program where appropriate.

Performance Evaluation#

  • Explain the pass/fail criteria used to evaluate the medical device.

  • State the final pass/fail status of your prototype.

  • Use specific results from your program to support the final status.

Technical Challenges and Debugging#

  • Describe one programming error you encountered while developing or testing your program.

  • Explain what caused the error.

  • Describe how you identified and corrected the error.

Gradescope Submission#

  1. Save Deliverables: Ensure all required assignment files are saved and named exactly as specified in the assignment instructions. If a template file name contains the word template, replace only that word with your Purdue username. When a task lists more than one deliverable, such as a workbook and a report, submit each deliverable to its own matching Gradescope assignment instead of combining them into one upload.

  2. Navigate to Gradescope: Log in to Gradescope. From your Dashboard, open the assignment.

  3. Upload your work: Select the Upload submission method. Drag and drop all required files (or a compressed .zip folder) into Gradescope, and select Upload.

  4. Confirm Submission: When your upload is successful, you will see a confirmation message on your screen and receive an automated email receipt.

  5. Add Team Members (if applicable): If this is a team assignment, add all team members to the submission. Each teammate should confirm they can see the submission in their own Gradescope account. For help, visit Gradescope’s documentation on adding team members.

  6. Review Autograder Results: Wait a few minutes for the autograder to evaluate the relevant files. Scroll down to view any failed test cases. If you need assistance interpreting the output or errors, ask your teaching team.

  7. Resubmit if Necessary: You can edit your files and select Resubmit as many times as you need before the assignment deadline. Only your final, active submission is graded. (Note: If you need to resubmit, you must upload all required files for the assignment again).

For a detailed walkthrough, review the official Gradescope Submission Guide.