Question: Make a function called symmetricDifference that takes two strings: word1 and word2 as parameters and returns a unique list of the letters that do not
Define a function symmetricDifference with two string parameters. You can expect strings with only alphabetic characters and no numeric or special characters.
Convert both the strings to lowercase
Return a list of letters that do not occur in both the words. Note that multiple occurrences will only be marked once in the output list.
Hint: You can make use of the set data structure to remove duplicate elements.
Define main function
Create two strings of your choice with only alphabetic characters. You can alternatively use the sample inputs provided below:
Call the symmetricDifference function with the created strings
Print the results
Call the main function using " __name__ == __main__" call as done in the previous assignments
Sample Input/Output:
>> print(symmetricDifference('apple', 'party'))
>> ['e', 'l', 'r', 't', 'y']
Step by Step Solution
There are 3 Steps involved in it
Implementation of the symmetricDifference function and the main function to achieve the desired func... View full answer
Get step-by-step solutions from verified subject matter experts
