Consider the statements given below and then choose the correct output from…
2025
Consider the statements given below and then choose the correct output from the given options: L = ['TIC', 'TAC'] print(L[::-1])
- A.
['CIT', 'CAT'] / ['CIT', 'CAT']
- B.
. ['TIC', 'TAC'] / ['TIC', 'TAC']
- C.
['CAT', 'CIT'] / ['CAT', 'CIT']
- D.
['TAC', 'TIC'] / ['TAC', 'TIC']
Attempted by 881 students.
Show answer & explanation
Correct answer: D
Step 1: The list L is defined as ['TIC', 'TAC'].
Step 2: The slice L[::-1] reverses the order of elements in the list.
Step 3: The reversed list becomes ['TAC', 'TIC'].
Step 4: The print statement outputs the reversed list.
हिन्दी उत्तर:
चरण 1: सूची L को ['TIC', 'TAC'] के रूप में परिभाषित किया गया है।
चरण 2: L[::-1] स्लाइस ऑपरेटर सूची के तत्वों के क्रम को उलट देता है।
चरण 3: उलटी सूची ['TAC', 'TIC'] बन जाती है।
चरण 4: print विधि उलटी सूची को आउटपुट करती है।