val = ["98 + 35", "3801 - 2", "45 + 43", "123 + 49"]
def arithmetic_arranger(values,state = False):
#split list
new_lst = [x.strip().split() for x in values]
first = []
second = []
not_first = []
its_width = []
second_width = []
dashes =[]
# #appending the items into their corresponding lists
for i in new_lst:
first.append(i[0])
second.append(i[2])
not_first.append(i[1:])
# this will be the width of the digits in the second line
for i in new_lst:
new_width = len(max(i[0],i[2])) + 1
second_width.append(new_width)
#this will be the width of items in the first line
for i in new_lst:
width = len(max(i[0],i[2])) + 2
its_width.append(width)
return its_width
return second_width
print(arithmetic_arranger(val))
Hey can you help me with the above code this is my first project and I am stuck because the last values of the its_width and second_width are not correct . I don’t know what I did wrong but this is the part of my code that im failing to understand why.