3. Given st="WELCOME" What will be the value of
a) st[-4]
b) st[0]
c) st[5]
d) st[-1]
in python
Answers
Answered by
54
We have a variable st with the value 'WELCOME'.
a) st[-4] will give the output:
- 'C'
b) st[0] will give the output:
- 'W'
c) st[5] will give the output:
- 'M'
d) st[-1] will give the output:
- 'E'
String indexing/string slicing is using index values to obtain a substring from a given string.
The index values represent the characters in the string.
- Positive indexing [left to right] starts from 0.
- Negative indexing [right to left] starts from -1.
For the string 'WELCOME', the positive indexing will look like this:
The negative indexing will look like this:
Answered by
27
Answer:
Answer :-
a) st[-4]
'C'
b) st[0]
'W'
c) st[5]
'M'
d) st[-1]
'E'
Positive Value :-
Negative Value
Know Møre :-
Python is a high Language programming. It is used to program mark,words and some other things on it. In Python can be array created.
Range of python is (). It has 0 as default
Similar questions
English,
2 months ago
English,
2 months ago
Math,
2 months ago
Environmental Sciences,
5 months ago
Music,
5 months ago
History,
11 months ago
Social Sciences,
11 months ago