IndexError: list index out of range while using aws

Question:

When I ran this code on Jupyter and Virtual Machine, it ran smoothly. But when I started running in on AWS, it always shows list index out of range. I would like to know how to fix this problem. Thanks!

Code:

AWS log:

When I ran this code on Jupyter, it shows:

Answer:

You could either use

Or

In either case, your original code does not produce the result you think it does.

Leave a Reply