🎁BACK-TO-SCHOOL DEAL. Subscribe Now to get 40% OFF at only 8.49 USD/month, only valid until Sep 30th, 2024

Question

Question
Declaring a string scalar Write a statement that assigns a string scalar namePerson to the following sequence of 11 characters: Jon, Pressor Script Save Reset MATLAB Documentation Run Script Assessment: Submit Check if variable name Person exists Check if namePerson is a string Is the assignment correct?

Asked By GoldenSunset48 at

Answered By Expert

Adrian

Expert · 4.8k answers · 4k people helped

Step 1/1

Below is the correct statement in MATLAB as per the requirement asked in question

Explanation for learning purpose

Explanation:

Explanation:

In MATLAB, you can assign a string scalar by enclosing the characters within single quotes.

Explanation:

Explanation:

So, when you execute the statement namePerson = 'Jon,Pressor'; , you create a string scalar variable named namePerson containing the value "Jon,Pressor."

Explanation:

Explanation:

This string scalar can be used in MATLAB for various purposes, such as displaying, manipulating, or analyzing text data.

Final Answer

Overall the correct answer along with explanation has bene provided.

🧑‍🏫 More Questions

For questions <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.7278em;vertical-align:-0.0833em;"></span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">5</span></span></span></span> solve each equation. Simplify the final answer as much as possible. Section 9.1 1. <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8141em;"></span><span class="mord">5</span><span class="mord"><span class="mord mathnormal">x</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">250</span></span></span></span> 2. <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8974em;vertical-align:-0.0833em;"></span><span class="mord">3</span><span class="mord"><span class="mord mathnormal">x</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">2</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">10</span></span></span></span> 3. <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord mathnormal">x</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1.0641em;vertical-align:-0.25em;"></span><span class="mord">2</span><span class="mclose"><span class="mclose">)</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">16</span></span></span></span> 4. <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord">5</span><span class="mord mathnormal">x</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1.0641em;vertical-align:-0.25em;"></span><span class="mord">3</span><span class="mclose"><span class="mclose">)</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">45</span></span></span></span> 5. <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord">2</span><span class="mord mathnormal">x</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1.0641em;vertical-align:-0.25em;"></span><span class="mord">6</span><span class="mclose"><span class="mclose">)</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">20</span></span></span></span> Section 9.2 For questions 6-9 solve each equation by completing the square. 6. <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8974em;vertical-align:-0.0833em;"></span><span class="mord"><span class="mord mathnormal">x</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">6</span><span class="mord mathnormal">x</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">7</span></span></span></span> 7. <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8974em;vertical-align:-0.0833em;"></span><span class="mord"><span class="mord mathnormal">x</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.7278em;vertical-align:-0.0833em;"></span><span class="mord">4</span><span class="mord mathnormal">x</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">3</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">0</span></span></span></span> 8. <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8974em;vertical-align:-0.0833em;"></span><span class="mord"><span class="mord mathnormal">x</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">3</span><span class="mord mathnormal">x</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">1</span></span></span></span> 9. <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8974em;vertical-align:-0.0833em;"></span><span class="mord">2</span><span class="mord"><span class="mord mathnormal">x</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">5</span><span class="mord mathnormal">x</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">4</span></span></span></span> Section 9.3 For questions 10-12 solve each equation using the quadratic formula. 10. <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8974em;vertical-align:-0.0833em;"></span><span class="mord">3</span><span class="mord"><span class="mord mathnormal">x</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.7278em;vertical-align:-0.0833em;"></span><span class="mord">5</span><span class="mord mathnormal">x</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">7</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">0</span></span></span></span> 11. <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8141em;"></span><span class="mord"><span class="mord mathnormal">x</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7278em;vertical-align:-0.0833em;"></span><span class="mord">8</span><span class="mord mathnormal">x</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">3</span></span></span></span> 12. <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord">2</span><span class="mord mathnormal">x</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord">1</span><span class="mclose">)</span><span class="mopen">(</span><span class="mord mathnormal">x</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord">5</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7278em;vertical-align:-0.0833em;"></span><span class="mord">−</span><span class="mord">3</span></span></span></span>

<h2>Movie ticket discounts revisited</h2><h2>CSW8 Learning Goals</h2><p>In this lab, you will:</p><ul><li>build on the solution to the <strong>3.15 LAB: Movie ticket discounts</strong></li><li>define and call a function with multiple parameters - you will need to add a new parameter to your previous solution</li><li>use the result of a function as part of the main program - the function will now return a <strong>list</strong> and a new <strong>error code</strong></li><li>practice creating a new list and <code>append</code>ing new elements to it</li><li>check the type of the variable is a list by using <code>if type(variableName) == list</code></li></ul><h2>Main Idea</h2><p>This lab is based on the <strong>3.15 LAB: Movie ticket discounts</strong>.</p><p>Your goal is to write a new function <code>get_ticket_price_discount()</code>, that builds on the <code>get_ticket_price()</code> and takes the following parameters:</p><ul><li>a base price (float) - <i>no longer hard-coded in the function</i></li><li>an age (integer)</li><li>a student status (Boolean)</li><li>a military status (Boolean)</li><li>a first-responder status (Boolean)</li></ul><p>The function returns <i><strong>a list</strong></i> that has <strong>any discounts that were applied</strong> to the resulting price (<i>in the order they were applied</i>) and the computed movie ticket price <strong>as the last element of the list</strong>.</p><p>The function returns error codes if the base price or the age are not valid.</p><h2>Instructions to write the function</h2><p><i>If the <strong>base price</strong> is 1 or less, the function returns </i><code><i>0</i></code><i> as an integer.</i></p><p><i>Otherwise, the function sets the ticket base price to be <strong>the provided base price parameter</strong>.</i></p><p>If the age is not valid, the function returns <code>-1</code> as an integer.</p><ul><li>If the Age 12 and under, the function subtracts $3 from the base price.</li><li>If the Age 65 and older, the function subtracts $2.</li></ul><p>In preparation for applying discounts, the function creates an empty list.</p><p>The function then independently checks the provided statuses <strong>in the order listed below</strong> and applies the following discounts:</p><ul><li>30% discount to students</li><li>25% - to military</li><li>20% - to first-responders</li></ul><p><strong>If any of the discounts were applied, the function stores the </strong><i><strong>discount percentage</strong></i><strong> as an integer in a list.</strong></p><ul><li>E.g., if the discount was 30% for a student ticket, the list would store <code>[30]</code>.</li><li>Make sure you write the the checking of the statuses in the order specified above.</li></ul><p>The function returns <i><strong>a list</strong></i> that has <i><strong>all</strong></i><strong> discounts that were applied</strong> to the resulting ticket price (<i>in the order that they were applied</i>) and includes the computed movie ticket price (as a float) <strong>as the last element of the list</strong>.</p><p>The function should <strong>not</strong> be rounding the result.</p><h2>The main program</h2><p>Get the price as a float input from the user.</p><p>Get the age as an integer input from the user.</p><p>Get the necessary statuses as an input string from the user:</p><ul><li>next, collect their response whether they are a student, then if they are military, and then if they are a first-responder.</li><li>If the user input <code>"yes"</code>, then convert the variable to the Boolean <code>True</code>; otherwise, set the status to <code>False</code>.</li><li>To convert the user input, use the <code>convert_yes_no()</code> function that was developed in class.</li></ul><p><i>Before</i> calling the function output a debugging print statement showing the arguments that are going to be passed into the function.</p><ul><li><code>print("Calling the function with", ..., ..., ..., ..., ...)</code></li></ul><p>Call the function <code>get_ticket_price_discount()</code> with the provided input arguments to get the result.</p><ul><li>Display the value that was returned from the function: <code>print("The function returned", ...)</code></li></ul><p>After we call the function, we can examine the returned value/object to determine what to output.</p><ol><li>If the function <strong>returns a list</strong> (check using the <code>type()</code> function):<ul><li>If the list contains a single element:<ul><li>Display the output as follows: <code>print(f'No discounts were applied.\nMovie ticket price: ${...:.2f}')</code>.</li><li>Remember to retrieve/index the first element of the list, otherwise, you will see the <code>[</code> <i>square brackets</i> <code>]</code> in the output.</li></ul></li><li>Otherwise, the list has more than one element, which means that the discounts were applied and we can display them.<ul><li>Use the <code>if len(...)</code> branches to detect how many discounts to output: you will need <strong>3 branches</strong> in order to display the result correctly.</li><li>Display the output as follows: <code>print(f'Discount applied: {...}%')</code> for each discount that is stored in the list.</li><li>Finally, display the <code>print(f'Movie ticket price: ${...:.2f}')</code> using the <strong>last element</strong> stored in the list. You can use <code>list_name[-1]</code> or <code>list_name[len(list_name)-1]</code> substituting your list's name for <code>list_name</code>.</li></ul></li></ul></li><li>Otherwise, if the function didn't return a list (i.e., it returned an integer error) display <code>Invalid input</code></li></ol><p>As before, remember to round the price to 2 decimal places in your <i>main program</i>!</p><h2>Testing the code</h2><p>The set up is the same as in the <strong>3.15 LAB: Movie ticket discounts</strong>, except that you are providing one more input value - the base ticket price - as the input in the main program, which uses it as the argument into your function.</p><p>If we call the new function with the same base price as what we used before, we should see that the returned value should still be the same as what we calculated previously.</p><h4>A 67-year old veteran (not a student nor a first-responder)</h4><p>For example, if the input is</p><pre><code class="language-plaintext">14.0 67 no yes no </code></pre><p>the <strong>return value from the function</strong> is</p><pre><code class="language-plaintext">[25, 9.0] </code></pre><p>and the <strong>output from the main program</strong> is</p><pre><code class="language-plaintext">Calling the function with 14.0 67 False True False The function returned [25, 9.0] Discount applied: 25% Movie ticket price: $9.00 </code></pre><h2>Troubleshooting / Hints</h2><ul><li>check for the validity of the <strong>price</strong> and then the <strong>user age</strong> <i>first</i>, before computing any prices.</li><li>Make sure you write the function logic in the <i>order specified by the instructions</i>.</li><li>remember that the function expects <strong>Boolean</strong> values, not strings "yes" or "no" (as indicated in the documentation)</li><li>To get the <strong>last element</strong> stored in the list, you can use <code>list_name[-1]</code> or <code>list_name[len(list_name)-1]</code> substituting your list's name for <code>list_name</code>.</li><li>The unit test is calling your function with the values that you are outputting as part of your debugging print statements in the main program.</li></ul><h3>Debugging your code</h3><p>If you take that output and then give it as the arguments into your function, you can print the result that comes back from the function to see if it is correct.</p><p>For example, for the test that is “Calling the function with <code>14.0 35 True False True</code>”, you can check what the function returns by <strong>hard-coding</strong> these values at the end of your main program to see the output:</p><pre><code class="language-plaintext">print("Calling the function with 14.0 35 True False True") result = get_ticket_price(14.0, 35, True, False, True) print("The function returned", result) </code></pre><p>&nbsp;</p><p>This is 3.15 code below:</p><p>&nbsp;</p><p>def get_ticket_price(age, is_student, is_military, is_first_responder):<br>&nbsp; &nbsp;"""<br>&nbsp; &nbsp;This function takes as an argument<br>&nbsp; &nbsp;param: age (int) - the age of the customer<br>&nbsp; &nbsp;param: is_student (bool) - whether the customer is a student<br>&nbsp; &nbsp;param: is_military (bool) - whether the customer is/was in the military<br>&nbsp; &nbsp;param: ... (bool) - whether the customer is a first responder<br>&nbsp; &nbsp;<br>&nbsp; &nbsp;The function returns a floating-point value corresponding to the&nbsp;<br>&nbsp; &nbsp;computed movie ticket price.<br>&nbsp; &nbsp;<br>&nbsp; &nbsp;If the age is not a value greater than 0,<br>&nbsp; &nbsp;the function returns an integer -1.<br>&nbsp; &nbsp;"""<br>&nbsp; &nbsp;ticket_price = 14.0<br>&nbsp; &nbsp;if age &lt;= 0:<br>&nbsp; &nbsp; &nbsp; &nbsp;return -1<br>&nbsp; &nbsp;elif age &lt;= 12:<br>&nbsp; &nbsp; &nbsp; &nbsp;ticket_price -= 3<br>&nbsp; &nbsp;elif age &gt;= 65:<br>&nbsp; &nbsp; &nbsp; &nbsp;ticket_price -= 2<br>&nbsp; &nbsp;if is_student:<br>&nbsp; &nbsp; &nbsp; &nbsp;ticket_price *= 0.7<br>&nbsp; &nbsp;if is_military:<br>&nbsp; &nbsp; &nbsp; &nbsp;ticket_price *= 0.75<br>&nbsp; &nbsp;if is_first_responder:<br>&nbsp; &nbsp; &nbsp; &nbsp;ticket_price *= 0.8<br>&nbsp; &nbsp;return ticket_price</p><p>def convert_yes_no(input_string):<br>&nbsp; &nbsp;<br>&nbsp; &nbsp;if input_string.lower() == "yes":<br>&nbsp; &nbsp; &nbsp; &nbsp;return True<br>&nbsp; &nbsp;elif input_string.lower() == "no":<br>&nbsp; &nbsp; &nbsp; &nbsp;return False<br>&nbsp; &nbsp;else:<br>&nbsp; &nbsp; &nbsp; &nbsp;return None</p><p>&nbsp; &nbsp;<br>if __name__ == "__main__":<br>&nbsp; &nbsp;age = int(input())<br>&nbsp; &nbsp;<br>&nbsp; &nbsp;student_response = input()<br>&nbsp; &nbsp;is_student = convert_yes_no(student_response)<br>&nbsp; &nbsp;<br>&nbsp; &nbsp;military_response = input()<br>&nbsp; &nbsp;is_military = convert_yes_no(military_response)<br>&nbsp; &nbsp;<br>&nbsp; &nbsp;responder_response = input()<br>&nbsp; &nbsp;is_responder = convert_yes_no(responder_response)<br>&nbsp; &nbsp;<br>&nbsp; &nbsp;print("Calling the function with", age, is_student, is_military, is_responder)<br>&nbsp; &nbsp;result = get_ticket_price(age, is_student, is_military, is_responder)<br>&nbsp; &nbsp;if result == -1:<br>&nbsp; &nbsp; &nbsp; &nbsp;print("Invalid age")<br>&nbsp; &nbsp;else:<br>&nbsp; &nbsp; &nbsp; &nbsp;print(f"Movie ticket price: ${result:.2f}")</p>

Name Section Experiment 10 Advance Study Assignment: Analysis of an Aluminum-Zinc Alloy 1. On the following page, construct a graph of No, vs. % Al. To do this, refer to Equation 11 and the discus- sion preceding it. Note that a plot of N vs. % Al should be a straight line (why?). To fix the position of a straight line, it is necessary to locate only two points. The most obvious way to do this is to find No, when % Al = 0 and when % A1 = 100. If you wish you may calculate some intermediate points (for example, Nu, when % Al = 50, or 20, or 70); all these points should lie on the same straight line. To use a spread- sheet, set up Equation 11 for different Al percentages. Graph Nyt, vs. % Al. 2. A student obtained the following data in this experiment. Fill in the blanks in the data and make the indicated calculations: Mass of gelatin capsule 0.1134 g 23°C Ambient temperature, 23+273=296 Mass of capsule plus alloy sample 0.3218 g Ambient temperature, T 296 K Mass of alloy sample, m g Atmospheric pressure 732 mm Hg Vapor pressure of H20 at 1 (Appendix I) Mass of empty beaker 154.3 g mm Hg Mass of beaker plus displaced water 401.6 g Mass of displaced water Pressure of dry H2 g PH, (Eq. 7) mm Hg Volume of displaced water (density = 1.00 g/mL) atm mL Pressure of dry HZ L Volume, V, of H2 = Volume of displaced water mL = Find the number of moles of H, evolved, nu, (Eq. 5; V in liters, Pit in atm, T in K, R= 0.0821 liter- atm/mole K). moles H2 Find, NH, the number of moles of H, per gram of sample (Mu,m). moles H/g Find the % Al in the sample from the graph prepared for Problem 1. % Al Find the % Al in the sample by using Equation 11. % A006C Advance Study Assignment: Analysis of an Aluminum-Zinc Alloy 0.050 0.040 0.030 VHA 0.020 0.010 25% 50% 75% 100% % AI (11) 100-%A1 -X0.0153 + 100 in Nu = (100X0.0556) We can solve Equation 11 directly for % Al if we know the number of moles of H, evolved per gram of sample. To save time in the laboratory and to avoid arithmetic errors, it is highly desirable to prepare % Al in the sample can be read directly from the graph. Directions for preparing such a graph are given in advance a graph giving Nh, as a function of % Al. Then when Nh, has been determined in the experiment, Problem 1 in the Advance Study Assignment.