Skip to content
Advertisement

If-Elif Statement is not working as I expected in python [closed]

I want to adjust lists to the same length but the if-elif statement is not working as I thought, its very weird. This might be something so obvious

Code:

JavaScript

I keep getting:

JavaScript

What I want:

JavaScript

Advertisement

Answer

Your main issue is comparing two lists instead of using the length of each. Also, I feel like you swapping the lists might’ve confused you and propagated down to the rest of the code (lines 8 & 9 and 13 & 14 -> affected lines 16 & 20). Nevertheless, I just fixed some parts and think it should work now for what you want it to do. Also, you might want to double-check your math for getting the length.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement