Challenge: Regulation Comparator
When working with legal regulations, it is common to compare different versions to identify what has changed. In this challenge, you will use two hardcoded lists in Pythonβeach representing a set of regulation section numbers or names from two versions of a regulation. Your task is to compare these lists and clearly display which sections have been added and which have been removed. To do this effectively, you will need to find the differences between the lists, then format your output so that it is easy to see which sections are new and which are no longer present. This approach helps legal professionals quickly understand regulatory changes and focus their compliance efforts.
Swipe to start coding
Write a function that compares two hardcoded lists of regulation sections and identifies which sections have been added or removed in the new version.
- Identify all sections present in
new_sectionsbut not inold_sectionsas added sections. - Identify all sections present in
old_sectionsbut not innew_sectionsas removed sections. - Output the list of added sections after the label "Added sections:".
- Output the list of removed sections after the label "Removed sections:".
Solution
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 4.76
Challenge: Regulation Comparator
Swipe to show menu
When working with legal regulations, it is common to compare different versions to identify what has changed. In this challenge, you will use two hardcoded lists in Pythonβeach representing a set of regulation section numbers or names from two versions of a regulation. Your task is to compare these lists and clearly display which sections have been added and which have been removed. To do this effectively, you will need to find the differences between the lists, then format your output so that it is easy to see which sections are new and which are no longer present. This approach helps legal professionals quickly understand regulatory changes and focus their compliance efforts.
Swipe to start coding
Write a function that compares two hardcoded lists of regulation sections and identifies which sections have been added or removed in the new version.
- Identify all sections present in
new_sectionsbut not inold_sectionsas added sections. - Identify all sections present in
old_sectionsbut not innew_sectionsas removed sections. - Output the list of added sections after the label "Added sections:".
- Output the list of removed sections after the label "Removed sections:".
Solution
Thanks for your feedback!
single