How can I compare two lists together, and create an output list where common items are shifted to match in index and name. The main list is made once and stays the same throughout the script.
There can be situations where the changing list will have items that do not exist in the main list, I'd like to create a separate list for these items...
Example:
main_list = ['apple', 'orange', 'banana', 'pear', 'mango', 'peach', 'strawberry']
changing_list = ['apple', 'banana', 'cucumber', 'peach', 'pear', 'fish']
output = ['apple', 'NA', 'banana', 'pear', 'NA', 'peach', 'NA']
added_output = ['cucumber', 'fish']
Using the sorted() function on each list before comparison may be of some use, however, I can't get my head around indicating that 'orange', for example is missing (preferably by using NA or X). I am aware of the option of using, sets and the '&' operator, however, using this does not indicate which item was missing with an index/positioning perspective (the NA part)