Write a Python program to convert the given list into a single integer.
Given List of integer
Input:
list1 = [1,2,3,4,5]
output: 12345
With the help of join method we can do this easily
Method 1: Without Method
# Converting integer list to string list
s_ints = [str(i) for i in list1 ]
# Join list items using join()
str_result = "".join(s_ints)
#convert string to integer
res = int(str_result)
Method 2: Using method
def join_list_data(list):
result= ''
for item in list:
result += str(item)
return result
result = join_list_data(list1)
#convert string to integer
result = int(result)
print(result)