In this video we dive into the concept of sequences and slicing. We begin by taking a closer look at character strings. This leads to the idea of substring extraction.
Below is an alternate loop method that pulls the characters from the sentence directly. I find this a little less appealing due to the manual manipulation of the variable i.
i = 0
for x in s:
if x == " ":
endpos = i
print( s[startpos:endpos] )
startpos = i+1
i += 1
Reference: Laboratory Manual for Computer Programming with Python, Multisim and TINA; Exercise 10, Tuples.
My free texts and lab manuals are available for download at my college web site https://www.mvcc.edu/jfiore and at my personal site http://www.dissidents.com
Inexpensive print and kindle copies are available at Amazon https://www.amazon.com/author/jimfiore
If you like my texts and videos, and would like to help defray the costs of making and maintaining them, consider making a modest donation at https://www.buymeacoffee.com/Professo...