Computer Science, asked by ys3056519, 9 months ago

"Computer Science" (0:6] =
"Computer Science" (3:10] =
"Computer Science"::-1) =
"Computer Science"(-8:1=
(2 points)​

Answers

Answered by June021
8

Answer:

"Computer Science"[3:10]

Output- ''puter S''

"Computer Science"[::-1]

Output- "ecneicS retupmoC"

"Computer Science"[-8:1]

Output- " "

Explanation:

It is done in Python 3.

"puter S" because starting position is 3 and ending position is 10 in slicing, assuming C as position 0, "p" is in position 3 and ends at 10 i.e. S but we take a number -1 than the ending number in python slicing, thus results in "puter S".

"ecneicS retupmoC" because ending point is -1, and while slicing if we want to reverse the input, we represent it as example- S(-7) c(-6) i(-5) e(-4) n(-3) c(-2) e(-1).  Here, e of Science is represented as -1 and followed by the rest. As no starting position is mentioned so the whole string is reversed here.

" " because at -8th position it is the space between Computer and Science thus the gap is displayed here.

Hope you understand the concept, please rate it accordingly.

Answered by Anonymous
1

Intrapersonal communication                      

Similar questions