Test Index
Python Revision Tour
© examsnet.com
Question : 70 of 102
Marks:
+1,
-0
Consider the statements given below and then choose the correct output from the given options :
Game="World Cup 2023"print(Game[-6::-1])
[CBSE 2024 Compartment]
Solution:
Concept:In
Index -6 is 'p' (index 8). Reading backwards from 'p' to 'W':
s[start::-1] the step -1 walks the string backwards from index start to the beginning of the string.Explanation:Game = "World Cup 2023" has 14 characters (index 0 to 13).| Index | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| Char | W | o | r | l | d | (space) | C | u | p | (space) | 2 | 0 | 2 | 3 |
| Negative | -14 | -13 | -12 | -11 | -10 | -9 | -8 | -7 | -6 | -5 | -4 | -3 | -2 | -1 |
puC dlroWAnswer:Option C (
puC dlroW)© examsnet.com
Go to Question: