Python Challenges: Short Long Short String

Transcript

English (Auto-generated)

what do you do? So what we're gonna be doing today is a fairly simple once again quoting challenge where we're giving two strings and what we have to return is mashed up version of those two strings. Or first we put the shorter strings. Then in the middle of the long string then ending with the shorter string. Once again this is pretty easy but let's go ahead and do it if you guys want you can pause the video and try to do it and some of your solution somehow. And yeah, let's try it out. So first we're going to create an empty list because I do it's always necessary from restoring things. Um especially those two students and you want to come back. So we're gonna do if length of A. Is greater than length deep. Just to start out saying what you thought on this one. Um We're going to add to the list and the list in this way since A. This is B. Is the biggest group and it is B plus A. Plus B. Thank you. And excuse me if you can hear me that much like the rain. But I mean try to speak a little bit louder. Okay so right there. Okay. No what are you doing? It's not that quick. We're gonna do helps. It must mean that he is great. Already A plus B. Plus plus A. Okay so now just to show you guys how this is going to look right now. Right this second do print short long short and then we're gonna do A. Equals bye and E. Equals okay three wise. Okay. And I'm also right here for getting to the return list. Okay. So let's see what that would give us right now, Python three is the name of our bow, which is for long four. Hi, because the fly paper. But I want to do right now. It's gonna look the same for our output in our journal. But we um, but it takes it differently. It's not, it's so currently a lift ministry. So what we're gonna do here, this string equals uh nothing got doing. And what we're gonna join is the list. Okay. And then we're gonna return the string and if you guys don't know how to understand what join join works basically takes a list in this way. Let's say we have one. No, let's say we have. Okay. Okay, it's nice. Okay. And we want to join it. It's basically can join all these things together into a string into one string. And the thing that you put before the dot join is what it's gonna join it with. So let's say we put a space and then not drawing list right there. Now what it's gonna do, let's say we um we still have our old list that said, hey, it's nice. So what it's gonna give us now is, hey, it's nice if we were to put dot that would do this. Hey, dot it's got nice without the extra space. I'm sorry. Okay. So I hope thank you. You guys have better understanding kind of how with um, joined words. Okay. And it should work perfectly today. Like I said, it looked the same in the terminal, but there are two different things. Okay, So thank you guys so much for tuning in. I hope you guys enjoyed this one. This is once again, it's simply one. I'm thinking about doing a few more that are quite basic and then starting to get into more advanced. But for this week and maybe the next one, we're gonna be doing quite basic things. But I hope you guys enjoyed this one and I hope you guys have interesting doing work list. I hope you guys have a good understanding on all that stuff. Okay, So thanks so much for joining and stay tuned for the next one. Okay.
21 Views 0 Likes 0 Comments

We are given two strings, we are going to return a string of those two string mashed together by putting the shorter string first, then the long string, then ending with the short string

Comment
Leave a comment (supports markdown format)