Examples :
Input: Input = [23] Output: Output = [2, 3] Input: Input = [15478] Output: Output = [1, 5, 4, 7, 8]
Method # 1: Using cards
|
Exit:
[2, 0, 0]
Method # 2: Using List Comprehension
|
Exit:
[ 2, 3, 1]
Method # 3: Using Loops
# Python code to split the list containing one integer
# Initialization list
input
=
[
987
]
# Convert to int
input
=
int
(
input
[
0
])
# Initialize the output list
output
=
[]
while
input
"
0
:
rem
=
input
%
10
input
=
int
(
input
/
10
)
output.append (re m)
# Printout
print
(output)
Exit:
[7, 8, 9]