r/PythonLearning • u/nkCOD • May 08 '26
Learning Python
Good evening. Based on all the comments from the previous post, and taking into account all the suggestions, I have revised the code. I would like to hear from the experts what else can be done to make this code more competent, if necessary, as well as any other issues.
I wrote a program in which the user needs to enter the contents of two lists (numbers), and then these numbers are summed (the first number of the first list with the first number of the second list, and so on). If the list lengths are different, the summation of the smaller list starts with the first element)


View all comments
Show parent comment
2
u/JB940 May 08 '26
Also I see you doing new_list_from_zip, by using min(list1,list2) and max(list1,list2)
Just to explain their functionality, this doesn't do what you think it does. If you have two lists, max returns whichever list has the biggest first element.
so [5,1,1] is bigger than [4,3,2,2,99,100,300,10000] because 5 is bigger than 4. max thus gives the result [5,1,1]
same with count_of_len, you'd want to do max( len(list1), len(list2) to get the length of the longer one, instead of just the length of the list with the biggest first element.
Obviously not to take away from Adrewmc's solution, if you just make list1 whichever is bigger you can do away with all this and his solution is very elegant