Question: Write a function mac checker() that takes one parameter, macs, which is a non-empty list of strings, each being a potential MAC address. Please Use

Write a function mac checker() that takes one parameter, macs, which is a non-empty list of strings, each being a potential MAC address.

Write a function mac checker() that takes one parameter, macs, which is

Please Use python to solve the problem.

Preliminaries For this lab you will be working with regular expressions in Python. Various functions for working with regular expressions are available in the re module. Fortunately, Python makes it pretty easy to see if a string matches a particular pattern CSE 101 - Fall 2017 Lab #11 Page 1 At the top of the file we must import the re module import re Then we can use the search) function to test whether a string matches a pattern. In the example below, the regular expression has been saved in a string called pattern for convenience: phone = , 123-456-7890, pattern = r'^\d {3)-\d(3)-\d { 4}$, if re.search (pattern, phone): print ('The string matches the pattern.') else: print ('The string does not match the pattern. The r that precedes the pattern string is not a typo. Rather, the r indicates that the string is a "raw" string. In a raw string, as opposed to a "normal" string, any backslash character is interpreted as simply a backslash, as opposed to defining an escape sequence like or \t. Make sure you use raw strings in your Python code when defining regular expressions. The and $ at the beginning and end of the regular expression indicate that the entire string must match the regular expression, and not just part of the string. Make sure you include these symbols in your regular expressions too! Part I: MAC Address Checker (20 points) Write a function mac.checker that takes one parameter, 'macs', which is a non-empty list of strings, each being a potential MAC address. (A MAC address is a ID number burned into the circuit of a network interface card.) Your function should examine each string in the list and return a list of indexes of the strings which meet the following description/requirement A valid MAC address string is a composition of six parts, with a semicolon':' between them. Each one of those six parts contains exactly two hexadecimal digits, meaning the two digits can only be a composition of 0-9 or A-F (letters must be capitalized) It is possible that macs contains no valid MAC addresses, in which case the function should return an empty list. Examples: macs1 macs2 macs3 ["CE 9B : F 1 : 02:94:49, , ["5E : 1E:23:44:9F : 17', [,9I : 13 : 6B : 5C : 3E : FF , , ,30 :CF 39:7E:E6:9C' , '1P:CC : DD : EE : FF : 1 1 , , ,DD : DI : 5a : 4F:2F : D4 , , ,3D:49:C7:23:B9:E8"] ,1D:D3, C1 :1C:32 :65' ] ,A1 : FC : 54:AB ! 92:55' ] = = = Function Call mac checker (macs1) [0, 1, 2] mac checker (macs2) [0] mac.checker (macs3)[0] Return Value

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!