The output of the program will be y
.
Here's the breakdown:
- The variable
color
is assigned the string"Navy Blue"
. - The expression
color[3]
accesses the character at index 3 of the string.
Strings are zero-indexed, so:
color[0]
is'N'
color[1]
is'a'
color[2]
is'v'
color[3]
is'y'
Thus, the output of print(color[3])
will be y
.