list = [('a5', 1), 1, ('a1', 1), 0, 0]
I want to group the elements of the list into 3, if the second or third element is missing in the list 'None' has to appended in the corresponding location.
exepected_output = [[('a5', 1), 1,None],[('a1', 1), 0, 0]]
Is there a pythonic way for this? New to this, any suggestions would be helpful.
listfor a list name.listas a name is because it shadows the built-in classlist. This prevents you from accessing the class and can lead to unwanted results or errors later on in your program.