a=[1,2,3,4,5,6,7] b=[0,2,8,9,10,11,12] a[0] to the end of the element If a[1]==b[1], I want to print out the list a and b that deleted a[1] and b[1].
If you do it like below, the out of range error comes out. I think it's because the number of elements in list a is decreasing.
Thank you.
a=[1,2,3,4,5,6,7]
b=[0,2,8,9,10,11,12]
for i in range(0,len(a))
if a[i]==b[i]:
del a[i]
del b[i]
a = [1,2,3,4,5,6,7]
b = [0,2,8,9,10,11,12]
new_a = []
new_b = []
for a_i, b_i in zip(a, b):
if a_i != b_i:
new_a.append(a_i)
new_b.append(b_i)
570 Uncaught (inpromise) Error on Electron: An object could not be cloned
564 PHP ssh2_scp_send fails to send files as intended
561 Understanding How to Configure Google API Key
578 GDB gets version error when attempting to debug with the Presense SDK (IDE)
558 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.