Q 1.2: Create and Assign Variables for Requested Components (3 marks) Create and populate variables containing the infor
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Q 1.2: Create and Assign Variables for Requested Components (3 marks) Create and populate variables containing the infor
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), Select Kernel • battery_type (String), • filter_frequency (float).
Create a list with the name component_details (case sensitive) containing the variables listed above. The order of the list entries should be: [resistance, number_of_resistors, led_colour, number_of_leds, number_of_min_pots, number_of_max_pots, number_of_jumpers_needed, battery voltage, battery charge_type, battery_type, filter_frequency]. Question 2: Dictionary Operations Q 2.1.: Resistor Availability Check (1 mark) Check whether the requested resistor value is available in the inventory and store the boolean result in the appropriate variable.
Q 2.2: LED Availability Check (5 marks) Determine the number of LEDs required by the student. Next, determine the number of LEDs that are available in the inventory. Finally, check whether there are enough LEDs. For this question, please use the following variable names for their prescribed goals: • number_of_leds_needed: Describes how many LEDs the student requires for the given colour. desired_led_colour: A boolean operator checking whether the colour of the LEDs required by the student is in the inventory. • max_available: Describes the number of LEDs that are available for the given colour. • enough_LEDs: A boolean operator checking whether there are enough LEDs in the given colour in the inventory. Hint: Check for case mismatches (use .lower()).