Python Lesson

This next function I created was to solve one problem, it was to create a list of the prefixes and suffixes for whichever key is indicated.

Next step is a while loop, where I indicate as long as the total value of x is less than the total length of the key provided, you continue to do the following actions. Those actions are first: using slices to create all the different prefixes and suffixes that occur for that particular key; then: for each pair of prefix and suffixes, you append them to your “finallist”. For each run through the while loop, there is a z+1 in the suffix creation. That means, that the suffix starts one after the prefix ended, so that we can create a function that allows for misspellings. It also allows for the function to continuously go through the list until there are no longer any letter to slice.
Creating this function took much longer, and was one of the longer hangups during this Problem Set, because I had never interacted with slices before. A slice, is a python term for taking/using only a part of a string. To indicate where you wish your starting point to be, you must simply say what position to start at (position number being 0 through however long your string is). I’ve a better understanding of slices now, and that help a bundle during the next couple of functions.