You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expand file tree
/
Permutations for all possible numbers from the digits of a provided number.py
"""Write a function that accepts a number as a parameter. The function should return a number that’s the difference between the largest and smallest numbers that the digits of the provided number can form."""
importitertools
num=input("Enter the Number : ")
l_num=list(num)
l_permutations=[]
list1=itertools.permutations(l_num)
forainlist1 :
str_num=""
foriina :
str_num=str_num+i
int_num=int(str_num)
l_permutations.append(int_num)
print ("Difference of Maximum possible and Minimum possible Number : ", max(l_permutations)-min(l_permutations))