Which of the following statements about arrays in Python is true?
What is the time complexity for accessing an element in an array in Python?
1 Crore+ students have signed up on EduRev. Have you? Download the App |
Which of the following statements is true about arrays in Python?
What will be the output of the following code?
arr = [2, 4, 6, 8]
print(arr[1])
What will be the output of the following code?
arr = [5, 10, 15, 20, 25]
print(arr[-2])
What will be the output of the following code?
arr = [1, 2, 3, 4, 5]
print(arr[2:4])
What will be the output of the following code?
arr = [1, 2, 3, 4, 5]
print(arr[-3:-1])
What will be the output of the following code?
arr = [1, 2, 3, 4, 5]
print(arr[::-1])
Given the following code, what will be the output?
arr = [1, 2, 3, 4, 5]
arr[2] = 10
print(arr)
Given the following code, what will be the output?
arr = [1, 2, 3, 4, 5]
arr.append(6)
print(arr)
Given the following code, what will be the output?
arr = [1, 2, 3, 4, 5]
arr.remove(3)
print(arr)
Given the following code, what will be the output?
arr = [1, 2, 3, 4, 5]
arr.pop(2)
print(arr)
Given the following code, what will be the output?
arr = [1, 2, 3, 4, 5]
del arr[1:3]
print(arr)
49 videos|38 docs|18 tests
|
49 videos|38 docs|18 tests
|