word="have a good day"
if i want to print only this word (good)
i will run this cod
print(word[6:11])
why i should write 6 ? and 11?
word="have a good day"
if i want to print only this word (good)
i will run this cod
print(word[6:11])
why i should write 6 ? and 11?
Take the time to read https://developers.google.com/edu/python/strings
Notice how the index into strings start at zero.
I too am confused by this. Shouldn't word[6:11]
be " good"
, not "good"
?
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.