Answers for "python how to split a number"

1

split a given number in python

# split a given int value in list
num = 13579
x = [int(a) for a in str(num)]
print(x)
Posted by: Guest on October-15-2021
1

python how to split a number

number = "12345"
result = []
for digit in number:
    result.append(digit)
print(result)
# result is ['1', '2', '3', '4', '5']
Posted by: Guest on October-24-2021

Code answers related to "python how to split a number"

Python Answers by Framework

Browse Popular Code Answers by Language