Python Program to Print All Distinct Uncommon Digits Present in Two Given Numbers

Python Program to Print All Distinct Uncommon Digits Present in Two Given Numbers

Python Program to Print All Distinct Uncommon Digits Present in Two Given Numbers. Given two positive integers A and B, the task is to print the distinct digits in descending order, which are not common in the two numbers.

Given two positive integers A and B, the task is to print the distinct digits in descending order, which are not common in the two numbers. Examples:

Input:_ A = 378212, B = 78124590_

Output:_ 9 5 4 3 0_

Explanation:_ All distinct digits present in the two numbers are {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}. The digits {1, 2, 6, 7} are common in both numbers._

_Input: _A = 100, B = 273

Output:_ 7 3 2 1 0_

Explanation:_ All distinct digits present in the two numbers are {0, 1, 2, 3, 7}. The digits {0, 1, 2, 3, 7} are common in both numbers._

*Approach: *The problem can be solved using sets, and lists in python. Follow the steps below to solve the problem:

sorting number-digits python list-programs python-set

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Python Sorting Lists — list.sort() vs sorted(list)

Python Sorting Lists — list.sort() vs sorted(list). The 2 common ways to sort a list in Python are inputList.sort() or sorted(inputList). Well, inputList.sort()sorts the list in place, in other words, you loose the original list because it will be mutated to contain the new sorted list.

Python List sort: How to Sort List in Python

Python list sort() function sorts the list ascending by default. The sort() method sorts the items of a given list in the specific order.

Guide to Python Programming Language

Guide to Python Programming Language

Python Sets Tutorial | Sets in Python | Python Sets | Python Programming

Python Sets Tutorial explains what exactly Sets is with an example. Python Sets Tutorial | Sets in Python | Python Sets | Python Programming

Python Set

A set is a collection which is unordered and unindexed. In Python, sets are written with curly brackets.