Tutorials

Python 3 Code to Find Uncommon Words Between Two Strings in Command Line

main.py

# 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 = "Edopedia Programming Tutorials"
B = "Learning from Edopedia Programming Tutorials"

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

Well. I've been working for the past three years as a web designer and developer. I have successfully created websites for small to medium sized companies as part of my freelance career. During that time I've also completed my bachelor's in Information Technology.

Recent Posts

How can IT Professionals use ChatGPT?

If you're reading this, you must have heard the buzz about ChatGPT and its incredible…

September 2, 2023

ChatGPT in Cybersecurity: The Ultimate Guide

How to Use ChatGPT in Cybersecurity If you're a cybersecurity geek, you've probably heard about…

September 1, 2023

Add Cryptocurrency Price Widget in WordPress Website

Introduction In the dynamic world of cryptocurrencies, staying informed about the latest market trends is…

August 30, 2023

Best Addons for The Events Calendar Elementor Integration

The Events Calendar Widgets for Elementor has become easiest solution for managing events on WordPress…

August 30, 2023

Create Vertical Timeline in Elementor: A Step-by-step Guide

Introduction The "Story Timeline" is a versatile plugin that offers an innovative way to present…

August 30, 2023

TranslatePress Addon for Automate Page Translation in WordPress

Introduction In today's globalized world, catering to diverse audiences is very important. However, the process…

August 30, 2023