Write the output of the print command in the given table.
a = "Python World"
| Print statement | Output |
|---|---|
print(a[0]) | |
print(a[-2]) | |
print(a[5]) | |
print(a[7]) | |
print(a[-9]) | |
print(a[10]) |
Show SolutionHide Solution↓
The output of the print commands is given below:
| Print statement | Output |
|---|---|
print(a[0]) | P |
print(a[-2]) | l |
print(a[5]) | n |
print(a[7]) | W |
print(a[-9]) | h |
print(a[10]) | l |
Explanation:
$$\begin{matrix} 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \\ \bold P & \bold y &\bold t &\bold h &\bold o &\bold n & \space &\bold W &\bold o &\bold r &\bold l &\bold d \\ -12 & -11 & -10 & -9 & -8 & -7 & -6 & -5 & -4 & -3 & -2 & -1 \\ \end{matrix}$$