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

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 occur in both words in ascending order.

 

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

1 Expert Approved Answer
Step: 1 Unlock

Implementation of the symmetricDifference function and the main function to achieve the desired func... View full answer

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 Programming Questions!