What is the output of the below code? >>import array >>> a = [1, 2, 3] >>> print a[-3] >>> print a[-2] >>> print a[-1] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the output of the below code? >>import array >>> a = [1, 2, 3] >>> print a[-3] >>> print a[-2] >>> print a[-1]

1st Aug 2020, 10:05 AM
Nishan
2 Answers
+ 9
The output will be: Syntax error: Missing Parenthesis You can try it yourself but don't forget to use parenthesis in your code. Output: 1 2 3 And also please remove irrelevant tags from your question as it decreases the accuracy of search bar.
1st Aug 2020, 10:23 AM
Arctic Fox
Arctic Fox - avatar
+ 4
Nishan , you don't need to import "module array" in your case, because it is never used in this code. what you create with: a = [1, 2, 3] is a regular list with 3 integer elements.
1st Aug 2020, 11:18 AM
Lothar
Lothar - avatar