My query is " why don’t we get same error in cell3 as we get in cell1" ?
Because in cell3 i have exceeded the string length and calling index values from 4-19 which is empty.
Similarly I have called 20index value in cell1 which is empty but I get error as out of range
anyone please explain.
i know it’s a basic thing but finding a lot to answer myself
You state you are in the beginning of a ‘jupyter notebook course’. You probably are learning Python using Jupyter notebook as the environment/interface. Jupyter notebook supports many languages, such as Julia, Bash, and R, through kernels.
So when seeking help, you need to keep in mind is your issue tied to Jupyter or is it tied to the language I am running in the kernel. If it is tied to the language you are using, then you want to seek help in places targeted at that language. Not here, which is targeted at the Jupyter world. Python is able to be run aside from the Jupyter notebook and sometimes you can tell if it is a Python issue if you run that code in those places and see the same result. If your course isn’t showing you how to run Python elsewhee, you may want to ask or look into it yourself.
That being said, a lot of people knowledgeable in Python are here…
Here your issue has to do indexing and slicing in Python. Look into those. (Hint: try a lower number in cell #1.)