Write python function create_largest_number() which accepts a list of numbers and returns largest number possible by concatenating the list of numbers
Answers
Answered by
2
Python program to create_largest_ number() which accepts a list of numbers and returns largest number possible by concatenating the list of numbers.
Explanation:
Python Program
def create_largest_number(numList):
numList.sort()
n = ""
for x in numList:
n = str(x) + n
return (int(n))
lst=[23,78,66,10,21]
largest_number=create_largest_number(lst)
print('Largest number after concatenating the list of numbers : ', largest_number)
Output
Largest number after concatenating the list of numbers : 7866232110
Similar questions