# Numbers in lists by SeanMc from forums
# define a procedure that takes in a string of numbers from 1-9 and
# outputs a list with the following parameters:
# Every number in the string should be inserted into the list.
# If a number x in the string is less than or equal
# to the preceding number y, the number x should be inserted
# into a sublist. Continue adding the following numbers to the
# sublist until reaching a number z that
# is greater than the number y.
# Then add this number z to the normal list and continue.
#Hint - "int()" turns a string's element into a number
def numbers_in_lists(string):
result=[]
sublist=[]
result.append(int(string[0]))
j=0
for i in range(len(string)-1):
if j==len(string)-1:
break
elif i>=j-1:
if int(string[i])>=int(string[i+1]):
reference=int(string[i])
for j in range(i + 1, len(string)):
if reference >= int(string[j]):
sublist.append(int(string[j]))
elif reference < int(string[j]):
break
result.append(sublist)
sublist = []
elif int(string[i])