47.3k views
2 votes
>>> phrase = "abcdefgh"

>>> phrase[3:6]

User Ilomambo
by
4.6k points

1 Answer

14 votes

Answer:

Following are the correct code to this question:

phrase = "abcdefgh"#defining a variable phrase that holds a string value

print(phrase[3:6])#use print method for slicing and print its value

Output:

def

Step-by-step explanation:

In the above code, a variable "phrase" is defined that holds a string value, and use a print method, inside the method, the variable is used as a list and use slicing.

It is a characteristic that enables you to access the series parts like strings, tuples, and lists. It also uses for modifying or removing objects in series, in the above slicing it starts from 3 and ends when it equal to the 6th letter, that's why it will print "def".

User Rob Mascaro
by
4.6k points