Advertisements
Advertisements
प्रश्न
Select the correct output of the following code:
event="G20 Presidency@2023"
L=event.split(' ')
print (L[::−2])
विकल्प
'G20'
['Presidency@2023']
['G20']
'Presidency@2023'
MCQ
उत्तर
['Presidency@2023']
Explanation:
The split() function separates a string based on a delimiter character and returns a list of its components. event.Split() generates a list containing ['G20', 'Presidency@2023']. Split the string on'' and print the result (L[::−2]). To get ['Presidency@2023'], return values from the list backward and skip by 2.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?