Hey Guys , i have understand issue regarding the tutorial for this code as follows :
>>> title="Little Apple"
Why am i not getting 'Little' ??
as from my understanding now 'L' is in the index 0 & 'e' is in index 5
Thanks for Taking time reading
Python Tutorial - 4 - Slicing up Strings
Post a Reply
|Oldest Newest Rating|
· March 3, 2015
title = "Little Apple"
first = title[0:] => this will print the whole title ("Little Apple")
second = title[0,6] => this will print the word "Little"
(in the second example it will start slicing from the first given argument which is 0 and continue till the second given argument-1)
third = title[:6] => this will print the word " Apple"
i hope i was able to clear the doubt
This section is all about snakes! Just kidding.
|Bucky Roberts Administrator|