{"id":13655,"date":"2021-10-01T10:00:02","date_gmt":"2021-10-01T04:30:02","guid":{"rendered":"https:\/\/python-programs.com\/?p=13655"},"modified":"2021-11-22T18:33:31","modified_gmt":"2021-11-22T13:03:31","slug":"python-program-to-rearrange-the-given-number-to-form-the-smallest-number","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-rearrange-the-given-number-to-form-the-smallest-number\/","title":{"rendered":"Python Program to Rearrange the given Number to form the Smallest Number"},"content":{"rendered":"

In Python, we will write a program that will rearrange the digits of a given number to produce the smallest possible number. We will rearrange the number so that it creates the smallest possible number with the number and the number digits being the same as the given number.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given number =17831047264891<\/pre>\n

Output:<\/strong><\/p>\n

The smallest number that can be formed from 17831047264891 is [ 10112344677889 ]<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given number =4851381128859729830005768<\/pre>\n

Output:<\/strong><\/p>\n

The smallest number that can be formed from 4851381128859729830005768 is [ 1000112233455567788888899 ]<\/pre>\n

Program to Rearrange the given Number to form the Smallest Number<\/h2>\n

Below are the ways to rearrange the given Number to form the smallest Number in Python.<\/p>\n