Page 1 of 1

File Edit Selection View Go Run Terminal Help Restricted Mode is intended for safe code browsing. Trust this window to e

Posted: Tue Jul 12, 2022 8:11 am
by answerhappygod
File Edit Selection View Go Run Terminal Help Restricted Mode Is Intended For Safe Code Browsing Trust This Window To E 1
File Edit Selection View Go Run Terminal Help Restricted Mode Is Intended For Safe Code Browsing Trust This Window To E 1 (100.66 KiB) Viewed 22 times
File Edit Selection View Go Run Terminal Help Restricted Mode is intended for safe code browsing. Trust this window to enable all features. Manage Learn More ◆ emr201.py sect1debugger.py 2 + a2022EMR201A01 Submission.py 1 2022EMR201 Assessment Sect1.ipynb X Extension: Python C: > Users > Katondo > AppData > Local > Temp > Rar$Dla8768.9894 > 2022EMR201 Assessment Sect1.jpynb > M+EMR 201- Assessment Section 1 > M+Tutorial Questions (10 marks) > M41.6. Question 6 O + Code + Markdown | Outline ... 598 A LI 5x 360 Ohm resistors - 4x Green LEDs 2x minimum resistance potentiometers - 3x maximum resistance potentiometers - 25x Jumper wires - A 3 V rechargeable Alkaline battery 2022EMR201 Assessment Sect1.ipynb - Visual Studio Code May I request that you ship all available components from the list above to the following address: 25 Simon Avenue, Brooklyn, Pretoria. 2. Assignment (32 marks) Email Question During the lockdown period, the EECE Department appointed an Inventory Manager to manage and distribute second hand components from the Electronic Component Initiative (ECI) to students in need. The Ineventory Manager received the following email: From: [email protected] To: [email protected] Dear Inventory Manager, I have a practical assignment in which I have to design a simple RL Filter. I require the following components for my electronics kit. Could you kindly check whether you have them in stock? John Doe 08 8 Activate Windows The component inventory is stored in a dictionary in the file emr201.py, which is provided. The following questions are all based on the email and the data in the dictionary, with the aim to generate responsettings Activate Windows. email student. 5035135 ℗ Restricted Mode A Type here to search 0 X X Ⓒ... I would also appreciate some guidance regarding which inductor I should use, as I am not sure how to calculate the required value. If I use your minimum resistor value, what value inductor should I use to achieve a high-pass cut-off frequency of 5000 Hz? Would you be able to also give me one of these minimum value resistors to use in my filter? Thank you in advance for your time and trouble. Kind regards, 10 ... Jupyter Server: local Cell 9 of 19 R Q 8:02 PM 11-Jul-22
File Edit Selection View Go Run Terminal Help Restricted Mode is intended for safe code browsing. Trust this window to enable all features. Manage Learn More 8. → emr201.py sect1debugger.py 2 + a2022EMR201A01_Submission.py 1 Extension: Python 2022EMR201 Assessment Sect1.ipynb X C: > Users > Katondo > AppData > Local > Temp > Rar$Dla8768.9894 > 2022EMR201 Assessment Sect1.jpynb > M+EMR 201 - Assessment Section 1 > M4 Tutorial Questions (10 marks) > M41.6. Question 6 O + Code + Markdown | Outline ... The component inventory is stored in a dictionary in the file emr201.py, which is provided. The following questions are all based on the email and the data in the dictionary, with the aim to generate a response email for the student. A 503585 Question 1: Creating Variables and Population of Variables Hint: Check the comments in the code for tips. LI Q 1.1.: Create and Assign Variables for Personal Details (2 marks) Create an interface which allows the inventory manager to enter the required details from the student email in variables. The required data are: • name (String), • • student_number (Integer, do not include the 'u'), • delivery_required (Boolean), • delivery_address (String). Create a list with the name personal details (case sensitive) containing the variables listed above. The order of the list entries should be: [name, surname, student_number, delivery_required, delivery_address]. surname (String), Q 1.2: Create and Assign Variables for Requested Components (3 marks) Create and populate variables containing the information regarding the components needed by the student. The required data are: • resistance (Integer), • number_of_resistors (Integer), led_colour (String), • number_of_leds (Integer), number_of_min_pots (Integer), • number_of_max_pots (Integer), number_of_jumpers_needed (Integer), battery voltage (String), battery charge_type (String), battery_type (String), • filter_frequency (float). 2022EMR201 Assessment Sect1.ipynb - Visual Studio Code Consta a list with the nAMA ZAMBAnant fesen Restricted Mode 0 A 3 Type here to search datsile (esca concitiu) containing the varishlar lietad shaun Tha nedar of the list antrine chould kan D0% 16 X X Ⓒ... Activate Windows Go to Settings to activate Windows. ... | Jupyter Server: local Cell 9 of 19 R Q 8:03 PM 11-Jul-22

File Edit Selection View Go Run Terminal Help Restricted Mode is intended for safe code browsing. Trust this window to enable all features. Manage 89 A 8 LI Learn More → emr201.py sect1debugger.py 2 + a2022EMR201A01 Submission.py 1 Extension: Python 2022EMR201 Assessment Sect1.ipynb X C: > Users > Katondo > AppData > Local > Temp > Rar$Dla8768.9894 > 2022EMR201 Assessment Sect1.jpynb > M+EMR 201 - Assessment Section 1 > M4 Tutorial Questions (10 marks) > M41.6. Question 6 + Code + Markdown | Outline ... Q 2.5: Battery (4 marks) 2022EMR201 Assessment Sect1.ipynb - Visual Studio Code ℗ Restricted Mode 0 A 3 Type here to search Extract the specifications of the battery and test whether they meet the requirements posed by the student (see the email). Hint: use .upper() or lower() to remove case sensitivity when comparing strings. Q2.6: High-Pass RL Filter (5 marks) The equation below shows how the inductance value for a given cut-off frequency and resistor value of a passive high-pass RL filter is determined. Use this equation to determine the inductor value required for a given cutoff frequency using the minimum available resistor value in the inventory. R L = 2π f 08 Create a variable and store the resistance (in 2) of the minimum available resistor. Create another variable and store the inductor value (in $\mu$H), accurate to two decimal places in the variable. Assume has a value of 3.14. Check if the calculated inductor value is within the range of capacitor values in the inventory. 18 0 X X Ⓒ... 4 ✓ Question 3: Draft Response Email (6 marks) Draft a response email to the student to have the exact formatting for each line as shown below. Replace the values in square brackets with the variables in the assessment. line_1: To: u[student number]@tuks.co.za line_2: From: [email protected] line_3: Dear [student name] [student surname], line_4: As requested, I have also calculated the inductor value required for your RL high-pass setup. When using the smallest available resistor ([minimum resistance resistor] 2), you should use an inductor with an inductance of approximately [inductor val] $\mu$H. [Inductor availability string] line 5: The following components will be made available to you: line_6: [no. resistors]x [resistor value] resistors, line_7: [no. LEDs]x [LED colour] LEDs, line_8: [no. min_pots]x [minimum resistance potentiometer] potentiometers, Activate Windows Go to Settings to activate Windows. ... (1) Jupyter Server: local Cell 9 of 19 R Q 8:03 PM ^ (64)) 11-Jul-22
File Edit Selection View Go Run Terminal Help XRestricted Mode is intended for safe code browsing. Trust this window to enable all features. Manage Learn More 8 A LI 2022EMR201 Assessment Sect1.ipynb X → emr201.py + a2022EMR201A01_Submission.py 1 Extension: Python sect1debugger.py 2 C: > Users > Katondo > AppData > Local > Temp > Rar$Dla8768.9894 > 2022EMR201 Assessment Sect1.jpynb > M+EMR 201 - Assessment Section 1 > M4 Tutorial Questions (10 marks) > M41.6. Question 6 + Code + Markdown | Outline ... Restricted Mode 0 A 3 2022EMR201 Assessment Sect1.ipynb - Visual Studio Code Type here to search 08 T25 16 Question 3: Draft Response Email (6 marks) Draft a response email to the student to have the exact formatting for each line as shown below. Replace the values in square brackets with the variables in the assessment. line_1: To: u[student number]@tuks.co.za line_2: From: [email protected] line_3: Dear [student name] [student surname], line_4: As requested, I have also calculated the inductor value required for your RL high-pass setup. When using the smallest available resistor ([minimum resistance resistor] ), you should use an inductor with an inductance of approximately [inductor val] $\mu$H. [Inductor availability string] line 5: The following components will be made available to you: line_6: [no. resistors]x [resistor value] resistors, line_7: [no. LEDs]x [LED colour] LEDs, line_8 [no. min_pots]x [minimum resistance potentiometer] potentiometers, line_9: [no.max_pots]x [maximum resistance potentiometer] potentiometers, line 10: [no.jumpers]x Jumper wires, line_11: 1x [minimum resistance resistor] resistor, line_12: [Battery availability string] line_13: Best of luck with your practical assignment. line_14: Kind regards, line_15: Inventory Manager Hint: The unicode characters for and μ, respectively, are: \u03A9 and \u03BC. 0 X X Ⓒ... Activate Windows Go to Settings to activate Windows. Jupyter Server: local ^ ( 4¹)) ... Python Cell 9 of 19 O 8:03 PM 11-Jul-22
File Edit Selection View Go Run Terminal Help Restricted Mode is intended for safe code browsing. Trust this window to enable all features. Manage Learn More + a2022EMR201A01_Submission.py 1 emr201.py X sect1 debugger.py 2 C: > Users > Katondo > AppData > Local > Temp > Rar$Dla8768.24285 > → emr201.py >... 1 ru o 8.9 A 2 3 4 5 6 7 8 9 15 16 17 17 10 18 10 # 11 # Section 1 support 12 13 14 10 19 20 20 27 28 29 30 31 32 33 34 35 36 37 EMR201 Support Module - SECTION 1 :copyright: Copyright 2020-2023 by the Department of EECE, | University of Pretoria. All rights reserved. from typing import Union Restricted Mode available_components = { "resistors": [10, 27, 56, 100, 270, 360, 1000, 5600], "led": {"green": 4, "red": 5, "blue":3}, 21 22 23 24 25 def strip_whitespace(line_list: Union [list, tuple]) -> tuple: 26 email_lines = list() for line in line_list: } "potentiometers": [1e3, 10e3, 20e3, 50e3, 100e3], "capacitors": [1e-9, le-8, le-7, le-6, le-5, le-4], "inductors": [le-6, le-5, le-4, 1e-3, le-2, 1e-1], "jumpers": 27, "battery": "1.5V rechargeable Alkaline", "ICS": ["OPA543", "TL084", "MCP6024"], if not isinstance(line, str): line = str(line) line.strip() email_lines.append(" ".join(line.split())) return tuple(email_lines) if___ _name_ == "___main__": pass | Ⓡ 0 A 3 Type here to search emr201.py - Visual Studio Code 2022EMR201_Assessment_Sect1.ipynb T25 18 4 F Extension: Python D ☐ 08 P P R VSTUP Maran- 00000 Activate Windows Go to Settings to activate Windows. X X Ln 1, Col 1 Spaces: 4 UTF-8 CRLF (Python R O 8:14 PM 11-Jul-22
File Edit Selection View Go Run Terminal Help Restricted Mode is intended for safe code browsing. Trust this window to enable all features. Manage Learn More → emr201.py ➜ sect1debugger.py 2 C: > Users > Katondo > AppData > Local > Temp > Rar$Dla8768.34718> a2022EMR201A01_Submission.py >... 1 www o 2 2022EMR201 Assignment 1 3 4 5 6 7 8 8.9 A 9 10 11 LI 14 # 15 # 16 # 17 # 18 # 19 # 25 26 27 28 29 12 13 # available_components = { 20 # 21 22 23 24 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 Restricted Mode ‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒ Assessment ID: import emr201 Date: Surname and initials: Student number: # -- EXAMPLE OF AVAILABLE COMPONENTS DICTIONARY "resistors": [10, 27, 56, 100, 270, 360, 1000, 5600], "led": {"green": 4, "red": 5, "blue": 3}, "potentiometers": [1e3, 10e3, 20e3, 50e3, 100e3], "capacitors": [1e-9, le-8, le-7, le-6, le-5, 1e-4], "inductors": [le-6, le-5, le-4, le-3, le-2, le-1], "jumpers": 27, "battery": "1.5V rechargeable Alkaline", # "ICS": ["OPA543", "TL884", "MCP6024"], 2021EMR101A01 2022-07-11 Surname, I.N. 12345678 Returns: # -- QUESTION 1 # 01.1: Create required variables (2 marks) def create_personal_variables() -> list: """Create and return personal details variables. + a2022EMR201A01_Submission.py 1 X 2022EMR201 Assessment Sect1.ipynb list: Personal details # Write code below this line, DO NOT EDIT ABOVE THIS LINE ➖➖➖➖➖➖➖➖➖ personal details = None # Change this line to the desired result # Write code above this line, DO NOT EDIT BELOW THIS LINE ----- return personal_details Returns: # Q1.2: Create the requested component variables (3 marks) def create_component_variables() -> list: """Create and return component details variables. list: Component details a2022EMR201A01 Submission.py - Visual Studio Code # Write code below this line, DO NOT EDIT ABOVE THIS LINE ➖➖➖➖➖➖➖➖ 043 Type here to search T25 18 Extension: Python DO 08 FOOD Be warung S Ln 1, Col1 Spaces: 4 UTF-8 e W Cha www. wwwwww T Vaza San Diarr ... B "Solbrich man "gay na von Ha ▷ ... . E MAR .. Activate Windows Go to Settings to activate Windows. X X LF (Python RQ 8:24 PM 11-Jul-22
U Le AY A File Edit Selection View Go Run Terminal → emr201.py ➜ sect1debugger.py 2 C: > Users > Katondo > AppData > Local > Temp > Rar$Dla8768.34718 > a2022EMR201A01_Submission.py >.. 49 component_details = None # Change this line to the desired result #Write code above this line, DO NOT EDIT BELOW THIS LINE --------- return component_details LI 50 51 52 53 54 55 56 # -- QUESTION 2 57 58 # Q2.1 Resistors (1 mark) 59 def get_resistor_availability(components: dict, resistance: int) -> bool: """Check the availability of the required resistance in the 60 components dictionary. 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 Restricted Mode 0 Args: Returns: components (dict): Inventory of available components resistance (int): Required resistance bool: Resistor available # Write code below this line, DO NOT EDIT ABOVE THIS LINE ➖➖➖➖➖➖➖➖➖ Help + a2022EMR201A01_Submission.py 1 X 2022EMR201 Assessment Sect1.jpynb enough resistors = None # Write code above this line, DO NOT EDIT BELOW THIS LINE ➖➖➖➖➖➖➖➖➖ return enough_resistors # Q2.2 LED (5 marks) def get_led_availability (components: dict, desired_colour: str, led_number_needed: int) -> tuple: """Check the availability of the required LED(s). Args: www Returns: components (dict): Component inventory desired_colour (str): Required LED Colour led_number_needed (int): Required LED amount tuple: ( bool: colour available, bool: enough in stock, int: num LEDs allocated ) # Write code below this line, DO NOT EDIT ABOVE THIS LINE ➖➖➖➖➖➖➖➖➖➖ number_of_leds_needed = None desired_led_colour = None ..-21-61- 0 A 3 Type here to search a2022EMR201A01 Submission.py - Visual Studio Code T25 18 Extension: Python DO 08 FANAR www www. T BEG PAROD Dep BEIN Perch ** mm ▷ ... YLAND 1. DELAR A X Activate Windows Go to Settings to activate Windows. Ln 1, Col 1 Spaces: 4 UTF-8 LFPython RO 8:26 PM 11-Jul-22
e Lo 8.9 A File Edit Selection View Go Run Terminal → emr201.py ➜ sect1debugger.py 2 C: > Users > Katondo > AppData > Local > Temp > Rar$Dla8768.34718 > a2022EMR201A01_Submission.py >... desired_led_colour = None 97 98 max_available = None 99 enough LEDs = None 100 101 LI 102 103 104 105 106 113 114 115 116 117 118 119 120 121 107 108 109 110 # Q2.3 Minimum and Maximum Potentiometer Values (4 marks) 111 def get_potentiometer_values (components: dict): 112 136 137 138 139 140 141 142 # Write code above this line, DO NOT EDIT BELOW THIS LINE ---- # Determine the amount of LEDS allocated if enough_LEDs: 143 144 145 led_amount_allocated = number_of_leds_needed else: led_amount_allocated = max_available return (desired_led_colour, enough_LEDs, led_amount_allocated) """Get the maximum and minimum potentiometer values. Args: Help + a2022EMR201A01_Submission.py 1 X 2022EMR201 Assessment Sect1.ipynb components (dict): Component inventory Returns: 122 123 124 125 126 127 128 129 # Q2.4 Jumper Wires (2 marks) 130 def get_jumper_availability(components: dict, amount_of_jumpers_needed: int) -> tuple: """Check the availability of the number of jumpers. 131 132 133 134 135 tuple: (int: max value, int: min value) # Write code below this line, DO NOT EDIT ABOVE THIS LINE ------ max_pot = None min_pot = None # Write code above this line, DO NOT EDIT BELOW THIS LINE ‒‒‒‒‒‒‒‒‒ return (max_pot, min_pot) Args: components (dict): Component inventory amount_of_jumpers_needed (int): Required jumpers Returns: tuple: (bool: enough jumpers available, int: jumpers left) #Write code below this line, DO NOT EDIT ABOVE THIS LINE ➖➖➖➖➖➖➖➖ enough jumpers_available = None amount_of_jumpers_left= None Restricted Mode Ⓡ0A3 0 # Write code above this line, DO NOT EDIT BELOW THIS LINE -‒‒‒‒‒‒‒‒‒ Type here to search a2022EMR201A01 Submission.py - Visual Studio Code 18 Extension: Python DO 08 Lederra www www. BEG VAKNANDE apg Cheva BEIN ... The com mm Hver BELAN Perch ▷ ... X Activate Windows Go to Settings to activate Windows. Ln 1, Col 1 Spaces: 4 UTF-8 LFPython RO 8:26 PM 11-Jul-22
4 e ge 8 8.9 A File Edit Selection View Go Run Terminal Help → emr201.py sect1debugger.py 2 + a2022EMR201A01_Submission.py 1 X C: > Users > Katondo > AppData > Local > Temp > Rar$Dla8768.34718 > a2022EMR201A01_Submission.py >... 144 145 146 147 LI 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 # Write code above this line, DO NOT EDIT BELOW THIS LINE -‒‒‒‒‒‒‒‒ return (enough jumpers_available, amount_of_jumpers_left) # Q2.5 Battery (4 marks) def get battery_availability( components: dict, charge_type: str, battery_voltage: str, battery_type: str ) -> tuple: """Check if the battery in stock meets the requirements. Make the test insensitive to case. Args: components (dict): Component inventory charge_type (str): Battery charge type battery voltage (str): Battery voltage battery_type (str): Battery type Returns: tuple: (bool: battery match, str: battery status) # Write code below this line, DO NOT EDIT ABOVE THIS LINE battery_match = None # Write code above this line, DO NOT EDIT BELOW THIS LINE if battery_match: battery_status = components ["battery"] + " Battery" else: battery status = "The required battery is not in stock." return (battery_match, battery_status) 177 # Q2.6 High Pass RL Filter (5 marks) 178 def get_inductor_val(components: dict, frequency: float) -> tuple: 179 """Calculate the inductor value in uH to 2 decimal places. Check for inductor availability. 180 181 182 Args: 183 184 185 186 187 188 189 www components (dict): Component inventory frequency (float): RL filter frequency Returns: tuple: (float: capacitor value, bool: inductor availability) ☐ 2022EMR201 Assessment Sect1.ipynb 190 191 192 193 ℗ Restricted Mode Ⓡ0A3 # Write code below this line, DO NOT EDIT ABOVE THIS LINE ‒‒‒‒‒‒‒‒‒ rounded_inductor_val= None inductor_is_in_range = None Type here to search a2022EMR201A01 Submission.py - Visual Studio Code 18 Extension: Python DO 08 P ERAN R 20 Ver www D D. wa ENCA E Chevas R. PAPIL BRENDSHM San S ---- ▷ ... "SOURCYLIN X Activate Windows Go to Settings to activate Windows. Ln 1, Col 1 Spaces: 4 UTF-8 LFPython RO 8:27 PM 11-Jul-22 ^ ( 4 )
B> 4 e 195 ge 196 197 198 199 200 201 202 # -- QUESTION 3 203 204 # Q3: Draft response email (6 marks) def generate_response_email( 8.9 A File Edit Selection View Go Run Terminal → emr201.py sect1debugger.py 2 C: > Users > Katondo > AppData > Local > Temp > Rar$Dla8768.34718 > a2022EMR201A01_Submission.py >.. 193 194 LI 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 # Write code above this line, DO NOT EDIT BELOW THIS LINE --------- if inductor_is_in_range: availability_status = "The inductor falls within the values stocked." else: availability_status= "The inductor is not within the values stocked." return (rounded_inductor_val, availability_status) student_number: int, name: str, surname: str, min_resistor: int, rounded_inductor_val: float, availability_status: str, number_of_resistors: int, resistance: int, number_of_leds: int, led_colour: str, Help + a2022EMR201A01 Submission.py 1 X ☐ 2022EMR201 Assessment Sect1.ipynb number_of_min_pots: int, min_pot: int, number_of_max_pots: int, max_pot: int, number_of_jumpers_needed: int, battery_status: str, ) -> tuple: """Draft a response email. Args: student_number (int): Student number name (str): Student name surname (str): Student surname min_resistor (int): Minimum resistor value rounded_inductor_val (float): Inductor value availability_status (str): Inductor availability status number_of_resistors (int): Number of resistors resistance (int): Resistor value number_of_leds (int): Number of LEDs led_colour (str): LED colour number_of_min_pots (int): Number of smallest potentiometers min_pot (int): Smallest potentiometer value Restricted Mode 0 A 3 & Type here to search number_of_max_pots (int): Number of biggest potentiometers max_pot (int): Biggest potentiometer value number_of_jumpers_needed (int): Number of jumpers needed battery_status (str): Battery status a2022EMR201A01 Submission.py - Visual Studio Code 16 Extension: Python DO 08 ZA JEDEN K ZARA Burung A PROD A DAM w PNERS *** tha CONS SE www. . ▷ ... The man a BASE - VIDEOLAR VE AYA BE X Activate Windows Go to Settings to activate Windows. Ln 1, Col 1 Spaces: 4 UTF-8 LFPython RO 8:27 PM 11-Jul-22 ^ ( 4 )
4 e go 8.9 A File Edit Selection View Go Run Terminal → emr201.py ➜ sect1debugger.py 2 C: > Users > Katondo > AppData > Local > Temp > Rar$Dla8768.34718 > a2022EMR201A01_Submission.py >... LI 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 Returns: tuple: (str: line_1, ..., str: line_15) # Write code below this line, DO NOT EDIT ABOVE THIS LINE line 1 None line_2 = None line_3 = None line_4 = None line_5 = None line 6 None line 7= None line 8 = None line 9None line_10 = None line_11 = None line_12 = None line 13 = None line_14 = None line_15 None ℗ Restricted Mode A # Write code above this line, DO NOT EDIT BELOW THIS LINE --------- email_draft = emr201.strip_whitespace( ] line_1, line 2, line_3, line 4, line_5, line_6, line 7, line_8, line 9, line 10, line 11, Help + a2022EMR201A01_Submission.py 1 X 2022EMR201 Assessment Sect1.ipynb line_12, line_13, line 14, line_15, ) return email_draft Type here to search a2022EMR201A01 Submission.py - Visual Studio Code T25 18 Extension: Python 08 T www.m VAMOND Maran Pers\RM 1² *** www BEIN E Chevas R. ENCA ▷ ... a man Mar .... BRENDSHM Pen X Activate Windows Go to Settings to activate Windows. Ln 1, Col 1 Spaces: 4 UTF-8 LFPython RO 8:27 PM 11-Jul-22 ^ ( 4 )