How to stack indices and given values

后端 未结 3 1028
遥遥无期
遥遥无期 2021-01-28 17:04
seq1_values = [5, 40, 180, 13, 30, 20, 25, 24, 29,  31,  54, 46,  42, 50,  67, 17,
           76, 33, 84, 35, 100, 37, 110, 32, 112, 15, 123, 3, 130, 42]

def get_num_va         


        
3条回答
  •  一个人的身影
    2021-01-28 17:09

    You are making this a lot more complex than it needs to be. It smells like homework, so I am going to help you along for the stacking portion, but it still needs to be justified after this, and this does not add a pipe character at the end, so you will have to figure that out on your own:

    Something like this is all that you need for this in Python3 for stacking it like you need it:

    for idx in range(0, len(seq1_values)):
        if idx == len(values) - 1:
            print('| ', idx)
        else:
            print('| ', idx, end='')
    
    for val in len(seq1_values):
        print('| ', val, end='')
    

提交回复
热议问题