how to separate a string into 2 lists of numbers and letters python

The solution for “how to separate a string into 2 lists of numbers and letters python” can be found here. The following code will assist you in solving the problem.

stringtosplit = ‘hello75world’
letters = []
numbers = []
for k in stringtosplit:
if k.isalpha() == True:
letters.append(k)
elif k.isdigit() == True:
numbers.append(k)
letters = ”.join(letters)
numbers = ”.join(numbers)
print(numbers)
print(letters)

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in