Computer Science, asked by hero759hhd, 1 year ago

Q. What is the output of the
below code? my_list = [1, 2, 3, 4,
5]print(my_list[5])

Answers

Answered by LuckyYadav2578
3

Code is

my_list = [1, 2, 3, 4, 5]

print(my_list[5])

Output

There will be a error

Indexerror : list index out of range

Reason for error

  • You can see list indexing is from 0 to 4
  • but in print statement user gives the index 5 more than list indexing.
  • It means it will be a error.

Also see the attachment :-

Attachments:
Similar questions