Robotics & Artificial Intelligence
Give the output of the following Python code:
msg = "Artificial Intelligence"
print(msg[11:14])
- tel
- Int
- ell
- gen
Python String Manipulation
1 Like
Answer
Int
Reason — The given code stores the string "Artificial Intelligence" in the variable msg. Python follows 0-based indexing, where the first character is at index 0.
Index Table:
| Index | Character |
|---|---|
| 0 | A |
| 1 | r |
| 2 | t |
| 3 | i |
| 4 | f |
| 5 | i |
| 6 | c |
| 7 | i |
| 8 | a |
| 9 | l |
| 10 | (space) |
| 11 | I |
| 12 | n |
| 13 | t |
| 14 | e |
| 15 | l |
| 16 | l |
| 17 | i |
| 18 | g |
| 19 | e |
| 20 | n |
| 21 | c |
| 22 | e |
The statement msg[11:14] performs string slicing, where:
- 11 is the starting index (included)
- 14 is the ending index (excluded)
Thus, characters at index 11, 12, and 13 are selected: 'Int'.
Hence, the output is Int.
Answered By
2 Likes
Related Questions
Identify the type of graph shown below:

- Scatter plot
- Bar graph
- Pie chart
- Line graph
In AI problem scoping, "Who" refers to the:
- dataset used for training.
- end users affected by the project.
- programming environment used.
- hardware requirements of the project.
The keyword used to include a package or module in a Python program is:
- export
- include
- collect
- import
What will be the output of the Python code given below?
x = "BOARD EXAMINATION" print(x[0:4:2])- BOAR
- BA
- OR
- Error