Sep-19-2019, 02:13 PM
(Sep-19-2019, 01:58 PM)ichabod801 Wrote: You are not accounting for the case wher e DNA % 3 == 2. In that case you need to delete two items. The modulus operator gives you how many items you need to delete, so you can just do dna = dna[-(len(dna) % 3):]
if (DNA % 3 == 1 ): del dna[-1] print(dna) elif (DNA % 3 == 2): del dna[-2::] print(dna)
Yes I just fixed that but I like your idea much more seems way more efficient