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?

Recommended Answers

Take the time to read https://developers.google.com/edu/python/strings

Notice how the index into strings start at zero.

Jump to Post

All 2 Replies

I too am confused by this. Shouldn't word[6:11] be " good", not "good"?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.