How do I display the text that the slice function “sliced?” from a variable | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How do I display the text that the slice function “sliced?” from a variable

I’m a fairly new python programmer and I just learned the slice function. How would I print the text from that. (Sorry, I’m not good at explaining things.)

26th Dec 2017, 6:16 PM
RuthlessDust
RuthlessDust - avatar
2 Answers
+ 2
I think: print(put your slice command here) This is a sample from the python course: squares = [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] print(squares[2:6]) print(squares[3:8]) print(squares[0:1])
26th Dec 2017, 6:47 PM
Paul
Paul - avatar
+ 1
^^ Thank you!
26th Dec 2017, 7:17 PM
RuthlessDust
RuthlessDust - avatar