Horje
python program to find uncommon words from two strings Code Example
python program to find uncommon words from two strings
# Python3 program to find a list of uncommon words

# Function to return all uncommon words
def UncommonWords(A, B):

	# count will contain all the word counts
	count = {}
	
	# insert words of string A to hash
	for word in A.split():
		count[word] = count.get(word, 0) + 1
	
	# insert words of string B to hash
	for word in B.split():
		count[word] = count.get(word, 0) + 1

	# return required list of words
	return [word for word in count if count[word] == 1]

# Driver Code
A = "Geeks for Geeks"
B = "Learning from Geeks for Geeks"

# Print required answer
print(UncommonWords(A, B))




Python

Related
how to make a discord moderation bot python Code Example how to make a discord moderation bot python Code Example
chrome profiles user open with python Code Example chrome profiles user open with python Code Example
integer in python Code Example integer in python Code Example
pyqt5 cursor starting on a widget Code Example pyqt5 cursor starting on a widget Code Example
how to set default value in many2one Code Example how to set default value in many2one Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7