What will be the output of following code snippet?
x="iamaprogrammer"
print(x[2:])
print(x[3:8])
Answers
Answered by
1
Answer:
maprogrammer
aprog
hope it helps
Answered by
0
The output of the following snippet is-
x="iamaprogrammer"
We would start counting the letters from index 0.
'i' would be assigned index 0, 'a' would be assigned as index 1, and so on.
- print(x[2:])
The letter would be started printing from index 2 till the end.
Hence, "maprogrammer" would be printed for print(x[2:]).
- print(x[3:8])
The letter would be started printing from index 3 till letters with index 8.
Hence, "aprog" would be printed for print(x[3:8]).
Similar questions
Computer Science,
2 months ago
CBSE BOARD X,
2 months ago
History,
2 months ago
Science,
6 months ago
Math,
6 months ago
Math,
10 months ago
English,
10 months ago