Answer to Question #315304 in Python for sabiha4

Question #315304

shift numbers -2


given a string, write a program to move all the numbers in it to its start.


input


the input will contain a string A.


output


the output should contain a string after moving all the numbers in it to its start.


explanation


for example, if the given string A is "1good23morning456",the output should be "123456goodmorning",as it contains numbers at the start.


sample input 1


1good23morning456


sample output 2


123456goodmorning


sample input 2


com876binat25ion


sample output 2


87625combination


1
Expert's answer
2022-03-23T13:46:11-0400
A = input()


D = []
C = []
for c in A:
    if '0' <= c <= '9':
        D.append(c)
    else:
        C.append(c)
s = ''.join(D) + ''.join(C)
print(s)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS