CBSE · 083Class XII · 2024Section A1 mark

Question 10

2 April 2024 · Computer Science (083)

Select the correct output of the following code :

python
event = "G20 Presidency@2023"
L = event.split(' ')
print(L[::-2])

Answer

(b) ['Presidency@2023']

Explanation

split creates ['G20', 'Presidency@2023']. Slicing [::-2] reverses it and takes every second element, resulting in ['Presidency@2023'].