0
Can anyone explain why I'm getting an out of range error?
I wrote this code to practice list in lists, and it's throwing up an errors I've tried fixing it in different ways but can't make it return the right number. Any help would be massively appreciated. Thanks in advance! https://code.sololearn.com/cTTH3XB1782G/?ref=app
9 Antworten
+ 1
Right! Thank you Swim, I wasn't aware of that. That makes much more sense now. So if I want my code to print Flour 4, Sugar 4 etc, would I have to hard code that instead of refering to another list?
+ 1
I've fixed it now! Such a simple fix :)
+ 1
Thank you, I didn't realise you meant the same print statement at first. You've been really helpful, thanks! It's good to make the mistakes as part of learning!
0
Sorry I don't understand, as the list in list has two values in it, and I've followed the same logic as the example above.