Write a code get an integer number as input and print the odd and even digits of the number separately.
Input Description:
A single line containing an integer.
Output Description:
Print the even and odd integers of the integer in a separate line.
Sample Input :
1234
Sample Output :
2 4
1 3
My Answer:
n=int(input())
V=''
W=''
for i in str(n):
if(int(i)%2)==0:
V+=str(i)
LV=len(V)-1
fainal=V[0:LV]
for k in fainal:
print(k,end=" ")
print(int(V[LV]))
for j in str(n):
if(int(j)%2)==1:
W+=str(j)
LV1=len(W)-1
fai=W[0:LV1]
for l in fai:
print(l,end=" ")
print(int(W[LV1]))
Output is correct but not working
please help me