Question: 3) HTML Tag Checker Complete the function tag_checker) in the HTML_Processor_abcd001.py file that iterates through your list of tags, looking for matches. If there is

3) HTML Tag Checker Complete the function tag_checker) in the HTML_Processor_abcd001.py file that iterates through your list of tags, looking for matches. If there is a mismatch of start and end tags, raise an exception with the appropriate error message (see output section below). To check whether a pair of tags match use the is match () method in the Tag class. After going through the list, if there are still tags remaining in the stack, raise an exception with the appropriate error message along with the tags in the stack (see output section below) Additionally your tag_checker function should keep track of the unique tags encountered using a list unique tags. As you iterate through your list of tags, check and see if the tag appears in this list. If it doesn't, add it to the list. Once you have gone the list of tags and have not encountered any mismatches, return the unique_tags list. Output The output of your program should include the following One line for each tag you check, explaining the action and displaying the current contents of the stack. You will need to complete the str method of the Stack class to allow the information to be displayed properly. Some examples are Tag
pushed. Stack 1s now: [,
,
] Tag
is popped. Stack is now: [] Tag
- pushed. Stack is now: [, ,
- ,
- ,
, , ,, ] o An appropriate error message is printed if the HTML tags are not balanced Mismatched tags: and 1i> End tag without matching start tag Start tag (s) [,
without matching end tag (s) Your HTML_Processor_abcd001.py programme should now work fine with testl.html, test2.html, test3.html, test4.html and test5.html. The first two test files have balanced tags, the remaining files should result in the appropriate exception being raised
- ] Complete the main () function in the HTML Processor_abcd001.py file so that: o A confirmation message that all tags are balanced is printed All tags are balanced! o A list of all the unique tags encountered is printed HTML tags encountered:
,
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
