9. Write the output of the following. S = "Welcome to python world"
print(S[2 : 3])
print(S[2 : 10])
print(S[-2 : ])
print(S[-10:-2:2])
Answers
print(S[2 : 10]) is your answer
I can't conform the answer
Answer:
Write the output of the following. S = "Welcome to python world"
print(S[2 : 3])
print(S[2 : 10])
print(S[-2 : ])
print(S[-10:-2:2])
answer is:- print(S[2:3]) output is " l"
print(S[2:10]) output is "lcome to"
print(S[-2: ]) output is "ld"
print(S[-10:-2:2]) output id "to o"
Explanation:
in this question a String name S with the value "Welcome to python world " is define and to print the particular part of the string slicing concept of python is used, in slicing we slice a object using there index value the first value represent the starting of index and the second value represent the ending but it does the print the value at last index it leave the value at last and the third value denote the no. of steps taken from start to stop, by default step is 1
To know about more click here,
https://brainly.in/question/31655938
To know about more click here
https://brainly.in/question/11924821
#SPJ2