Here's my code:
# Code to separate the numbers alphabets in a string and print it in a list
# If the user gives empty string, then empty list must be printed
def string_string(string1):
number=''
alpha=''
empty=''
list1=[]
for i in (string1):
if(i>='a' and i<='z' or i>='A' and i<="Z"):
alpha=alpha+i
elif(i==1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 0):
number = number+i
elif(i== ''):
list1.append(empty)
else:
pass
list1.append(int(number))
list1.append(alpha)
print(list1)
string1 = str(input())
string_string(string1)
I want the code to behave as follows:
Case 1: (separate letters from numbers)
Input: a888rudhvigk
Output: ['arudhvigk', 888]
Case 2: (empty string)
Input:
(empty string)
Output: ['']