<p>我试着把自我分成五组,然后把两个单独的组颠倒过来
我希望我的输出如下</p>
<pre><code> step1.(group the list into two section of five)
[[1,3,5,67,8],[90,100,45,67,865]]
step2.(reverse the numbers within the two groups)
[[8,67,5,3,1],[865,67,45,100,90]]
</code></pre>
<p>我的密码</p>
<pre><code> class Flip():
def __init__(self,answer):
self.Answer = answer
self.matrix = None
self.L = [1,3,5,67,8,90,100,45,67,865,]
def flip(self):
if self.Answer == 'h':
def grouping(self):
for i in range(0, len(self.L), 5):
self.matrix.append(self.L[i:i+5])
print(self.matrix)
if __name__ =='__main__':
ans = input("Type h for horizontal flip")
work = Flip(ans)
work.flip()
</code></pre>
<p>当我运行代码时,我的输出是</p>
<pre><code> None
</code></pre>