![]() The second last character occupies position -2, and so on. The final character of the string has a negative index of -1. The characters in a string can also be indexed counting back from the end of the string. The character retrieved by the expression testString is assigned to indexChar and printed out. Use string indexing to select the third character from testString. ![]() The following example illustrates how string indexing works using real Python code. It has an index of 5 and is accessed using.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |