 So, I will quickly go over some questions that have been answered in the meanwhile before we go on to the subsequent sections. So, question is, so let us try this, switching over to the terminal, I will create a simple list. Now, let us check for float 3 in L, so what it is actually doing is it seems like it is checking the values, but to look at the details of why this makes sense and why this does not make sense, I will answer this question if you remind me in a little while, after I finish a little bit more of the content, I will answer that question. How to fix a type for a variable rather than letting the interpreter assign it by the value given to the variable, you cannot, short answer is you cannot by default in python, there are some strategies by which you can do certain things like that, but more often than not it is not all the time necessary to fix a type, there is no need to fix a type. Python 3 has some optional type annotation, but it is not still a mechanism to fix the type. How do you see the existing variables where in a particular session in a file, so it depends on the context of what you are trying to do and where you are trying to do it. In an ipython session, I think there is a command called who or whose, so if you look at this, who says print all interactive variables, so I can say percentage who, it will list to me the current variables in the ipython session, if that is what that is one answer for how to see existing variables that are defined, but that is an ipython convenience, it is not a built in that is available in python. So with that I think I have answered most all the questions, there are some things that I will revisit as I said once we get back, once we finish some more content. So let us move on to more content. So let us move on, so what we have next is strings and then we will do conditionals, loops and then come back to lists. So depending on where we are certain questions of yours will be answered, but I would suggest you wait for me until lunchtime, I will pause before lunchtime for a little while and we will ask detailed answer detailed questions. So let us move on to strings, more about strings, so anything within quotes is typically a string and to create a string variable you can do it in multiple ways, single quotes, double quotes or triple single quotes or double quotes and strings can be of any length, either single character or a null string any of that will work. So look at these examples, look at the slides, this is a string, it is a perfectly valid string. Please note that this quotation mark you do not have to put back ticks, it is always forward tick that is the quote that is below the double quotes the same character, usually on the right side of your keyboard, it is not the back tick which is near the tilde, so it is this character next to your return key typically. This is also a string actually there is a mistake here, this should be double quote here, there is a mistake here, this should be a double quote, yeah so this is a string too, so I will maybe type out the code on the terminal, notice that I close it, so whatever you open it with you must close it with, notice the triple quote, same quotation mark you put three of them that will be a string, similarly you can do it with three triple quotes, three double quotes instead of single quotes, this one is an empty string notice that comment denotes a hash denotes a comment that is in line. So why do we need this, why do we not need it will be obvious in a little while, so first thing is if I do double quote, inside a double quoted string I can put single quotes, so I do not have to do this back slash quote and all of this stuff, so it reduces the need for escaping, typically one line single quoted strings can only be one line long and if you want to put multiple lines you have to back slash, so for example let me try this, go to switching to the terminal, this is a very long string that I must escape with these silly back slashes, I made a mistake there, so close it with the same quotation mark, now this works, now notice that it is a pain because if I want to reform at this text I cannot do anything, whereas I can say a is 1, 2, 3, I can put as many new lines as I want. Now notice that in this case I did not have to worry about all of this, so triple quoted strings are super convenient and this could work for any of whether it is double, double quoted three double quotes or three single quotes it will be the same, it will allow you to write multi line documents, so the advantage is if you are writing documentation for your functions for a python code typically it will be in a triple quoted string, very convenient. So, moving on let us try to do assignment and operation operators with strings, so switching to the terminal let me clear the screen for you, so let us say a is hello and b is world, notice that as we discussed before c is a plus comma space plus b plus exclamation mark and notice that here again it does not matter what quotes I use, if it is a string I can add it, there is no sanctity about this string as that code, that string as this code you do not worry about all of that, now c will be hello world, so first part that we have done here is only the addition of strings, we have already seen this, the second part becomes interesting, so let us look at switch back to the terminal and look at a is hello, what happens if I do a star 5, what do you expect, normally I would expect an error, however if I say a star 5 there is one obvious way that all of us know that would be correct, a star 5 should simply be 5 copies of the string, correct, but then what about a 5 and a half, this has no obvious answer, how do I take half of a string, how do I take 0.23 of a string none of those has meaning, therefore if I do this it will tell me there is an error, a into 5 and a half will be a type error, it does not know how to multiply a floating point in a string, but it does know how to multiply a integer and a string, but what about a into a itself, again that has no meaning, cannot multiply sequences in non integral types of string with string, right, so basically most often if it is something that has an obvious way to do it and there is a good reason to do it, it should be doable, so know that you can multiply strings by integers, but not by floating point numbers, obviously you cannot multiply integers, similarly if I have a, a minus a, a plus a is fine, right, but a minus a does not have any meaning, similarly division all of those do not make much sense in this case, so how do you access the elements, switching back to the terminal, print a of 0, okay, let us switch back to the slide because this is sufficiently illustrator, what do you think a of 0 should print, it should print the first character, 0th index, it will be h, a of 4 will be the fifth index and what was a, a is hello, so the fifth fellow in a is o, a of 0 is h, a of 4 is o, now what is this minus 1, a of minus 1 is the last index, so often I want to go to the last to the end of the sequence, how will you normally do it, you will have to say a of length of the sequence minus 1, that is one way of doing it, right, which is stupid, instead if I can say a of minus 1 it will give me the last element, a of minus 4 will give me the 4 ones from the last, so it will be, what do you think it will be, a of minus 4, so one little trick before you try something to learn better, you first you ask yourself what the answer will be before you try it, do not just blindly type it and do it, it will be e because minus 1, so look at it this way, I will switch to the, I will switch to this writing pad, so I am going to write now here what we have is a is equal to h, e, l, l, sorry my l looks like an e, o, okay, now if I notice what are the indices associated with each of these, so let us look at the indices, so this is 0, 1, 2, 3, 4, okay. Similarly, what is this, it is also minus 1, minus 2, minus 3, minus 4, I think this should make it very clear as to what is happening, okay, so when I say let us switch back to the terminal, when I say a of minus 4 it should give me e, when I say a of minus 5 it should give me h, when I say minus 2 it should give me l, so on and so forth, so first question we have is what is a of 75, let us do not type it and hit enter, think about it for a second, what should it be, so what do you think it should be, if it is a good programming language some people may think oh it should wrap around, you do 75 you keep dividing by 5 and then give me that is a stupid way of writing, do not ever write a language like that because nobody will know what is happening, it should give me an error, so if I do this it will say index error, string index out of range, okay, very sensible, what about minus 24 or 35, that should also give me an error, okay, so which means yes, negative indices are supported, but negative indices have a context, positive indices can be from started 0, all the way to length minus 1, anything beyond that is illegal, negative indices started minus 1, go all the way to minus of the length, okay, so indices again make a lot of, it is a sensible way of looking at indices, positive and negative, once again go back to the white board, we look at a, it is hello, now please remember this applies to sequences in general, any sequence, if it is a list or a tuple, if I have 1, 2, 3, 4, 1 is the first, the value of the first index, so it will be 1, 2, 3, 4, so may be I will write it down here, so if I have L is equal to bracket 1, 2, 3, 4, okay, now this should also help you understand your slicing, so when you look at A of 1, 5 or something like that, you are essentially slicing inside the index domain, you are not slicing inside the value domain, you have to make sure that you remember, keep that in mind, so similarly I could supply indices in my slices which are negative and that is also legal python, so I can say start at minus 3 and give me all the way to the end, you can do that, fine, so now we know how to access the elements both with positive indices and negative indices and we understand that if you access something crazy, you will get an error and the error is what, switching to the interpreter, you clearly see that the error is something called the index error, notice here, every error in python has a name and typically it is used consistently throughout the language, so if you see an index error, it will mean that you have given it an invalid index, string index out of range, please remember these things, these details I am spending time explicitly showing you several things, so that you are able to follow, please try to make an effort to understand it, so now getting back, how can I change the elements, so let us try this, switching to the interpreter, A is hello, A of 0, let us make it uppercase, problem, it gives me an error, it says string object does not support item assignment, that is the error message, type error, the string type does not support object assignment, so let us try this with a list, L of 1 equals 0, this works because list types support item assignment, string types do not, the term that is used commonly in python is called immutable, there are certain objects in python like strings and tuples that are immutable, so for example if I have a tuple 1, 2, T of 0 equals 1 is also invalid because a tuple is also considered immutable, you cannot change a string in place, you cannot change a tuple in place, so strings are called immutable quantities, do not ask me why strings are immutable, why tuples are immutable, that is the nature of the language, strings are considered immutable, if you want to make something mutable, there are ways and means by which that can be done, so we will discuss those techniques later on, but in python just remember the fact, it is a fact strings are immutable, why it is this, why not that, you can do exercise, search, read up on Google or ask Guido if you are interested, this is not the time or place to discuss the details of why strings are like this, there will be several design decisions like this made in the language right through, specifically strings you will learn later on that it makes life a lot easier if you are they are immutable, just but for the purpose of this course keep in mind that strings are immutable, you cannot change them in place, so now let us look at a little problem to motivate studying a little more about strings, I cannot change strings in place right, however let us see one thing, a is defined to be hello, what is the type of a, type is str, it is a string type, now if I do a dot tab, you will see that it gives me a variety of completions, a dot tab, now if you see all of this stuff when you want to quit, you press, you see this more in the bottom here in the shell, means that it is paging the content for you, press q to quit, it will quit the pager, now each of these things that you see here like a dot find, a dot count, a dot upper, all of these are called methods, so if you look at the slides says strings have methods to manipulate them, so these methods allow you to do certain things with the string object, we will look at this, but to give you context we will give you a little problem, let us look at the problem, we are given a list, the list's name is called week, it contains names of the days of the week and you are given a string s and you have to check if the string is a day of the week, now we should be able to check for any of the forms like, so I could say sat, capital S A T, small S A T, Saturday or I could say capital Saturday, I have to make sure that regardless of what combination of letters I use, so long as I give it at least three letters, S A T should be there, S is not enough because S could be either Sunday or Saturday, so I give it three characters, any three I should be able to use to compare, how do we solve this problem using Python, so first thing we need to know is, I need to know the days of the week, those days of the week are stored in the list called week, so let us create that list, firstly I can encode all of the days of the week so we look at this little while, assume that I have the week list created with the names of the days of the week, Saturday, Sunday, Monday, Tuesday, Wednesday, so on and so forth, now I am given this string S, so I have week and now I am given this little string S, we have week as a list, we are given S, I now need to get the first three characters of S, because I want to be able to say, if I will have the first three characters I can uniquely identify whether it is a Saturday or a Sunday, I can find the week of the day of the week, the second thing I need to do is, I need to convert that to a lower case representation, so let us assume that I have week given by sat, Sunday, Monday, Tuesday Wednesday, Thursday, Friday, let us assume that this is my week, I have all the days of the week, just three characters that is enough, I am given S, now S could be say Saturday, Saturday, first thing I need to do is, I need to convert this to, I need to get the first three characters, how do we do that, the answer is to do slicing, so let us look at some slicing examples to get you refreshed, so what is this going to give me, Q of 0, 3, 0, 3, what is the answer, so let us switch to the slides, I want you to give me the answers, Q of 0, 3 will be H E L, 0, 1 and 2, again remember the indices I have H E L L O, that is my string, these are the indices 1, 2, sorry 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, the last is 10, so 0 to 3 will require, so when I say 0, 3 that will translate to index number 1, sorry 0, is this clear, does not include 3, so it will give me H E L, the answer, now try this, try Q of colon 3, notice that in the second example on the slides, the 0 is implicit, it is not explicitly specified, if you type this you will find that the answer is the same as 0, which means if I do not supply the first index, Python will assume it to be 0, the third example is even more interesting, if I do not supply the last index, Python will assume the end of the list, plus 1, inclusive of the end of the list, remember that it is not the same as giving it length minus 1, it will be length itself, finally what if I ignore everything, I just say colon, it will give me a copy of the entire list of the string, exact verbatim copy, so the lesson to learn here is, start index optionally the default value is 0, end index exclusive of that end delay index, default value is the last end of the list or the sequence, and if I do not specify either it means copy, full copy, clear so far, is everyone clear at this point, last two examples introduce negative indices in slicing, so first question is, q minus 1 colon 1, what should that give you, so what is q of minus 1, it means give me the last index, but what is this ending index, it means ending index is 1, but is the last index greater than the first ending index, yes, in this case yes, correct, in this case q's length is some 10 characters or 11, 11 characters, so minus 1 is actually 11 colon 1, so what should it give me, let us try it, what do we expect, we expect an empty list, sorry an empty sequence, which is what I get, so let me elaborate this carefully again, so remember your indices are 0, go back to this screen, to the interpreter, shell, look at the indices, h is 0, d is number 10, what is minus 1, minus 1 is 10, so q of 10 colon 1 will be what, what is the value of the start, start at the 10th fellow, go back what is the last index to the first fellow, sorry second fellow, but clearly your starting index is beyond your ending index, so you cannot put it anything, this is like saying for a for loop, your starting condition is, starting value is bigger than your ending condition, it will not even go into the for loop, correct, same way, when you specify the start index, the start index should definitely be less than the ending index, if not you will get nothing, it is an illegal, it is an invalid index, q of 10 colon 1 is, what about q of 2 colon 1, it should also be empty, q of 1 colon 1 will also be empty, why, because the last index exclusive, I am saying do not give me the last index and 1 is equal to that value, how about 0 colon 1, this has to work, is this clear, so which means, again the concept is I will again type this out on the interpreter, list of q of start optionally 0, I will leave the optionality part, start, end, exclusive and step, just remember this, so if the start value is bigger than the end or equal to the end, it will not get you any slice, so q of minus 1 colon 1 should be, q of minus 1 colon 1 should be empty, that is clear, what about q of 1 colon minus 1, q of 1 colon minus 1, so what should that give me, so it will start from E, L O space W O R L L or D, why not D, again remember the golden rule, end exclusive, end is minus 1, minus 1 equals 10, 10 is not included, so it will be till 9, so let us try it 1 colon minus 1, correct, so it is L O L, finally, what happens, maybe 1 or both of the limits is optional, so if I say what if I did this, what will I get, this will give me L, hello world or if I gave you 1 colon 0, that will give me hello world or if I did this, what if I did this minus 4, q of minus 4 colon minus 1, this should give me O R L, O R L, again golden rule remember, start and exclusive step, what if I did this quiz question, minus 4 colon 1 empty, why, it was a long string, what about minus say 25 colon 1, so now, now is where things get interesting, now is where so if I did q of 1 colon 175, the index is valid, is invalid, but the slice is okay, because you are saying give me everything till that, if nothing is there, fine, do not give me anything, similarly minus 25 will work, it will basically go to the start, so again imagine it as, so do it this way, if there is a negative index, translate it to the equivalent positive index, remember start colon end exclusive step, that is it and you will understand exactly what slices are doing, okay, so again we will do slicing when I do lists, so and then umpire arrays later on you will do, so we will proceed, we will move on, I think now you should understand, I have a reasonable idea of what is happening with slices, now the only thing additional we have not done is striding, I have not spent too much time, so the slicing part remains the same, the first two indices, the only thing that changes is the step, so can you tell me the answer for each of these, q 0 colon 5 colon 1, q is this, q is this, q of 0 colon 5 is hello, right, what is this q of 0 colon 5 colon 1, remember it is a step, I am stepping by 1, so it should be hello, so this is the same, what about this, so this should be h skip e, go to l, skip l, go to o, h l o, what about this guy, this will be h l simply because the third step goes beyond, it becomes 6, it becomes h l, what about this, h 0 colon 5 colon 4 should be h o, right, because I step by 4, I go straight to o, what about 0 colon 5 colon 5, this will be h, what do I make this 50, it will still be h, okay, so we have answered this question, now similarly what is 0 colon 2, 0 colon 2, again remember golden rule, if index not and middle fellow not specified, it means end, so h 0 double colon 2 will be h l o w r d, it is basically skipping every second fellow in between, what about this, if I do not specify first, it will be the same, if I do not specify the first it is 0 and I do not specify the second index, it means give me the whole thing, but skipping every 2 places, what about this, this will be same thing skipping every 3, skipping every 4, skipping every 100, remember when I do skipping by 100, it will give me the first one and then skip by 100, it will find nothing at the end, okay, so let us now look at q of 5 colon 0 colon minus 1, what will this do, start at 5th index which is o, right, so let us print q, q is hello world, q of 5 colon 0 colon minus 1 and now making a negative step, what will this do, so this will start at o, go all the way to 0 excluding 0, step in minus 1, sorry, actually the 5th fellow is space, h is 0, e is 1, l is 2, the other l is 3, o is 4, space is 5, so 5, h q of 5 corresponds to the space, space o l l e and it stops there, because do not include 0, okay, so let us try this now, 5 colon colon minus 1, this notice will now include the first element, not the last element, if the index was positive, this will be what, this will be world, so if you do not specify the default does magic, it could be 0, it could be minus 1, right, depending on or sorry, it could be the last fellow or it could be the first fellow, depending on what the sign of your step is, as far as you are concerned, if you do not specify it means end of whatever be that sequence, okay, finally q of colon 5 colon minus 1, right, again I will repeat this, came off in separate line, because I am counting in the negative direction, it will assume that the start is the end, so it will start at d, go all the way to the 5th fellow, and the last example is this, what will this do, this will reverse the string, okay, so the step size determines what is the first and what is the last, this is a positive step, okay, by the way, what will this do, minus minus colon colon minus 2 will give me skipping by 2, but in the negative direction, but for the whole copy, is this clear, so now what is the golden rule, this is correct, but modifier is defaults depend on sign of step, does this make sense, golden rule is q start, end exclusive, step, the step size sign determines what are the defaults for your start and end, so if you do not specify start and the default is positive, it will be 0, if you do not specify end, step is positive, default will be last plus 1, if you specify step as negative, it will be reversed, that is all, so it makes perfect sense, once you start reading this code, it will be a kind of obvious to you as to what these strings are doing, but this is very important that you understand slicing and sliding well, because it is a frequently used operation in Python, so someone has asked me to please re-explain q of minus 1 colon 1, so let us look at that q of minus 1 colon 1, so what is happening here, start is minus 1, minus 1 is at what position for our current string, it is the end, it is some 10 or something, so it is basically saying 10 colon 1, I have not specified the step, therefore by default the step is considered to be plus 1, so it will start at the last fellow, go in steps of 1, but he will check to see if the last fellow or wherever he is starting the index he is looking at is smaller than the end, which is 1, 10 is not bigger than 1, therefore this will give me an empty string, that is I will repeat, your starting value is minus 1 which is 10, your ending value is 1 and you want to step in steps of 1, obviously this is going to give me an empty string, because your starting value itself is beyond the range of what you want, on the other hand if I did this with a minus 1 then everything is different, this means start at the end, go all the way to the first, second character in your string, so it will be world in reverse without h and e, why because again remember the ending index is not inclusive, end is exclusive, it does not include end, so I have spent plenty of time now on slicing and striding, beyond this if you need some help, I think you can ask your local coordinators, we have spent a lot of time on this, I think it should be fairly clear now, I have drawn pictures, shown you several examples to illustrate the point. So, the next important thing is how do you convert this string to upper case, lower case, so it turns out as I showed you this queue fellow has several methods, so an edit tab it gives you lot of these underscore fellows, I say queue underscore some l e, all of these you please ignore, in some of your python sessions it may not even show, you may not even get these underscore, depending on your version of i python it may or may not show, so if it does not show well and good, but look at all the ones that do not start with an underscore, look at queue dot capital s, queue dot center, queue dot count, queue dot decode ends with all of these, all of these are called methods, so queue dot let us see there is something called lower, so queue is this, queue there is also something called upper, how do we find out what upper does, you do queue dot upper question mark, hit enter it will show you that s dot upper returns a string, returns a copy of the string converted to upper case, so let us try it queue is this, queue dot upper, now you have to call it like a function, so put open bracket close bracket enter, hello, so queue dot upper, now this itself is a string, so I can say x is queue dot upper, x dot lower, I can compress this into one same call, I can say queue dot upper dot lower, it will be the same as queue in this case, so two things important, one is most objects in python will have something where you can do dot and will have several methods that you can call, dot tab will present to you a list of all the possible completions, so if I say queue dot c tab, it will only show me the completion starting with c, so capitalize then I can tab complete and hit question mark, it will show me documentation title return to titled case version of s, so basically queue has methods that you can use, these methods in the case of strings will return, typically will return new versions or new copies of the string suitably modified, so if you do queue dot lower upper, you get a new string, the second important thing I showed you is, when I do queue dot upper, queue dot upper returns a string which is upper case, that itself has a dot, so string, so I can do queue dot upper dot lower that also will work, I can keep doing this, the reason is when I do queue dot upper, it gives me a string, that string also has a lower method, the lower fellow also gives me a string that also has an upper, so you can keep composing methods using the dot, it is important to realize, if you look at the slides strings are immutable, which means all of the methods will not modify the string, they will give you fresh copies of the string, so what is the solution to the problem that we had, I would not go to the solution, we had, so let us go back to the problem, given a list week, containing names of the day, the week and the string s, check the string is a day of the week, so what do we need to do, get the first three characters of the string, so what is s, s is Saturday, how do I get the first three characters, s 1, 0, 3, or I do not have to specify the 0, I can specify just colon 3, this will give me the first three characters, now this is nice, now do you understand why they do not include the index, I can say the first three characters is not 3 plus 1, not 3 minus 1, none of that, it is simply s colon 3, it will give me sat, now what do I need to do, convert it to lower case, notice that s colon 3 is also a string, so I can say s colon 3 dot lower, now how do I check whether this is the day of the week, use in, so s and be lazy, so use up arrow, get the previous line in week, what was week, week was all these days and now remember I converted it to lower case, because my week has stored everything as lower case, if my week had stored everything in upper case, I would have to suitably store everything in upper case, does this make sense, so we have the solution to our little problem, it is two lines of code, week is defined as this, s colon 3 dot lower in week, notice that you can do it in another way, you can say s dot lower colon 3 in week, this is also equivalent, obviously what is going to be obtained is different in each, s dot lower will lower case the entire s and then take the first 3, this will first take the first 3 characters and then lower it, that is the only difference. So with this we have looked at strings slicing, striding and a few of the string methods and we have solved a little problem, so let us look at some more additional useful methods that we think are useful, strings have many methods, we are not going to dive into each of them, how do you explore these methods, how do you find out more, so you do q dot tab, find whatever you are interested in, the other thing you can try is, if you want to say I want all the fellows starting with say title, you can do q dot star whatever substring, it will try to match and then put a question mark, it will tell you all of these methods are available, I am going a little advanced here but this is a useful trick to know, so I want to find all the strings that have, all the methods that have count, there is only one, anyway so there are several methods, one of the methods is called join, so let us see what join was all about, let us move back to the slides, supposing I am given a list of strings, we wish to join them into a single string, possibly each string separated by a common token, sometimes it could be a comma, it could be a colon, it could be a semicolon various things, for example I have a list of email addresses, this is a list of strings separated by commas, I now make, want to make this into one big string saying name semicolon, sorry email, semicolon, email, semicolon, email, so let us create a simple example for this, I will use a slightly different example to be lazy, banana, apple, some three fruits, I want to join these into a, make a string out of this, so there is a method called, I say what is this, what have I created now, open quote, comma, sorry space, close quote, what is this thing, what have I created, if I said x is equal to this, what would x be a string, I do not need to say x is equal to, so let us do this, dot join, this is a string, with the string it has a method, so I can say it has a bunch of methods, it has join in particular, if I now give it this list, it will make it into banana, this is equivalent to me saying, comma space, x, dot join, is this clear, just study the example once, I have created a list, the list contains three little strings of three fruits, then this comma space, this thing is a string, I am calling the strings method called join, and I am passing it this a as an argument, it joins all of these by putting a comma space in between each, notice that it is the same, so for example, it is done that, this is equivalent, the same one line of code is equivalent to me doing x is equal to this, y is equal to x dot join, it is the same thing, notice that if I did semicolon instead it will join with the semicolon, if I said no do not give me space, give me this, it will join it, or I could say banana is a fruit, apple is a fruit, orange, but notice it did not say orange is a fruit, so it will put this comma, this joining element only between two elements, so this is a useful method, so this we believe is, this is a very useful thing for you to know, there is one more thing that is useful, which is not quite here in the slide, it is called split, so let us consider this is a string, so first question what is x, x will be banana or apple or orange, what is y, y will be banana space apple, space orange, correct, now I want to do the reverse, I want a string that has these spaces or these separators, and I want to convert it to a list of those individual elements, so there is a method called x dot split, now let us look what split is, so x dot split says split and it has two optional parameters, one is called the separator, the other is called max split, max split says how many fellows should you split, both are optional, so what is it saying, s dot split returns a list of strings, it returns a list of words in the string s using sep as the delimiter string, if max split is given at most max split splits are performed, if sep is not specified or is none, any wide space string is a separator and empty strings are removed from the result, so let us see what this means, x is this, y is this, x dot split, what should it return, a list of words, in this case it is returning one word, how do I find the length of what it has returned, only one, notice there are no commas in this line, but remember I can give it a separator, so if I give it a separator as that r mark, now it returns three fellows, banana, apple and orange, similarly y dot split, what is y, y is this, now if I do y dot split, what should happen, so if you remember the documentation we read, it said if separator is not specified, any wide space is considered as a delimiter, so this will work, so this will actually give me banana apple orange, now let me try to split it on the character a, this will give me b n n p p l e orange, so basically it uses that separator as the character on which it is going to split, that separator character is going to be eliminated, as you see in this example, so if I do just split it gives me banana apple orange, so if you have say a string that is separated with semicolons or commas or space, with space you simply do split it will immediately split it, so let us try something little more complicated, this is a string with many new words and new lines, now let us do s dot split, notice that it has split it even looking at new lines, let me make this little worse, anything that is empty is eliminated, so this is a long string with many words, so if you have some long piece of text and you want to find all of the words, you can easily identify the words like this using, now I want to join this back, this is a list, I want to join them all back with, I can do that, just put space, notice that the new lines are all gone now, so join and split can be thought of as sort of complements of each other, just join a bunch of or a sequence of strings and you split a string into a list of substrings and you control how you split it based on the separator character, of course there is one thing you can do that we have not demonstrated, let us look at max split, notice that this is only split it twice, so I get this is and the rest of this.