 Alright so hey guys and welcome back to another pipeline tutorial. So in this tutorial we're going to be taking a bit of a step back and programming something a lot more basic than we have been programming in the recent tutorials. So this tutorial is what I'm going to be like a chillout tutorial where we program a password generator. So it's a pretty good project for beginners and if you're a beginner this is the perfect project for you. Because you'll be learning about arrays and how to nest different loops inside each other. So while it may seem simple to actually create a random password generator it can be a bit challenging to create. So without further ado let's get into it. First of all I'm going to go ahead and create visual studio. I mean go ahead and open visual studio not create visual studio that will take me another age. Cool so I'm going to get rid of this text right here. And then in here I'm going to type in Ctrl S to save this file and then save this as password generator.py. Cool. So once I've got that all saved up I can actually start coding. Now as I said before this password generator is going to create passwords randomly which is why we're going to need the random module more about that in a moment. So import random which is going to help us later. Now we need to specify the characters that we're going to be using to actually create this random password. Now I'm going to go from A to Z so A, V, C, D, E, F, G, H, F, J, K, L, M, M, P, Q, R, S, T, U, V, W, X, Y, Z. I'm also going to do the capitalization of these so A, V, C, D, E, F, T, U, V, W, X, Y, Z. And I'm going to do the numbers 1, 2, 3, 4, 5, 6. If you want to you can increase this range by however much you want. You can add special characters or as many numbers as you like. I'm going to go ahead and add a few special characters in here. Let's see what else there is. And that should be enough in my opinion. Let's do one of this and let's do this. Cool. So these characters can depend on this pretty much depends on your preference. The more you add in here, the more secure or hard to guess the password is going to be. Cool. So when our password generator runs, it's going to pick random characters, which means one character. It's going to pick random ones these and then combine them together to be a single password. So first off, we're going to need a main loop. So while true, so this loop will keep running no matter what. Now we need to gather what the password length is going to be. We need to ask the user what length they want their password to be. Let's do an input and then we'll assign that input to a variable called password length. Now, since it's an integer, we're going to do inter inputs because we're taking an integer input. What length would you like your password to be? And then we ask the user the question. Once that's done, we also need to know how many passwords the user would like to generate in one shot because that's a nice feature to have instead of having to run the program all over again to generate another password. So let's ask how many passwords would you like? Based on this, the password would be different each time the loop runs. So we are gathering what length the password needs to be. We're also gathering how many passwords we're generating for the user. Cool. Now that's actually getting to code the complicated bit of this loop. So now we're going to need a 4x in range loop, which means we give the loop a range of how many times it's going to run. So we want this loop to run as many times as there is as many times as the user wants to generate a password. So for x in range, I'm going to start on zero and then I'm going to end at password count. So I want to run this loop as many times as the user wants a new password. So if the user typed in two new passwords, we're going to run this loop two times. So I'm going to print x in here and show you what that does. It's pretty much going to print just a cancel of this function. Let's run this. Now it's going to state what length do I need my password. Probably 12 characters and how many would I like out of like three. So as you see right here, when I type in, I want to run it three times. The loop actually goes ahead and runs three times. And each time it increments the number one when it starts at zero. So it's actually run three times. Now to show you that it's actually working, I'm going to run it 10 times. And if I show you now, it actually runs 10 times. So obviously starting at zero, which is why the last number is nine, which means it ran 10 times. Cool, so that bit's working. Now let's go ahead and program the actual bit that's going to create the password for us. We need another for loop. So in this for loop, we're going to give it a range of how many characters the user wants in their password. So we're going to start from zero. We're going to run until the password length has been met. So we're going to run this loop. The number of times that the user wants the password length, because for each iteration of this loop, or each time this loop runs, we're going to add one character to their password. So as soon as we reach the password length, the password will be built up to as many characters as the user wanted it to be. Cool. So now let's go ahead and get rid of this printx variable right here. And instead of that, I'm going to create a new variable called password. And then I'm going to assign it to black. It's just a blank string. And that password is going to be populated with information in a second. So now we need to go ahead and actually make a grab the password character. So password character. So this is each character that's going to be selected for our password. He calls random job choice. Now dot choice, what it does is it goes ahead and selects a single character from one of... So basically what we need to do is that it's going to pretty much grab a random character from this string right here. So it's going to go ahead and give me a random character each time this loop runs. So if I print that, I can prove that to you. Print password character each time the loop runs, let's run it. And it should give me a different character from the character's string each time it runs. Okay, so I probably typed in something. So I'm going to type in 12 and I would like two boxes. And as I said before, guys, so here is the list of our strings. So it pretty much selects a random character from our character's string and then just prints it out each time the loop runs. Of course, since that's working all fine, let's get rid of this print statement. And now we're actually going to add the character that's being selected randomly each iteration of the loop to our password variable, which is going to slowly actually form our password. So our password variable is going to be the previous password variable. So anything that was already there plus the new password character that just got produced on the next iteration of the loop. And then once we're done, we're going to go back one end and print here is your password and then I'm going to do polo comma password. And if everything went well, it should just run perfectly. So cool, I'm going to layer that up and run it again. Now it's asking what length would you like your password? Let's go with how many passwords would you like? I'll go with I don't know. And as you see right here, guys, we have five different passwords which are looking pretty secure to me because they're literally a combination of random letters from the cares or characters string that we had. So the reason this when we use random does choice on the string, it treats it like an array. So the zero position would be a and so on. So it pretty much knows that it needs to select a random character from this character's string right here. We don't actually need to convert it into an array or thing like that. And then just like that, quite simply, we have created a little program that allows us to print as many random passwords as we want, which is obviously your password generator. Anyway, guys, that was it for today's tutorial. Hope you have actually enjoyed the content. I wanted to create sort of like a laid back tutorial because the last few tutorials have been a bit intense. I'm going from beginner to intermediate stuff. So just to jump back into the loop of beginner stuff and just to show you guys how actually nested loops and for loops can be used. If you guys have any suggestions for future videos, like always, guys, leave them in the committee tab under my post that says ideas for new videos. Also, guys, do consider joining the Discord channel that's going to be stated in the description. You can also follow my socials if you like on the Discord channel. We are it's pretty much just a chill channel. We just chill on there. We discuss ideas for next videos, troubleshoot any issues with previous code that you have. I don't know, show off your projects and a lot more. You just can meet a lot of cool stuff that can have similar interest to being cool people, cool stuff. Also, guys, if you'd like to donate to the channel directly, you can do so by purchasing a Super Chat emoji or a Super Chat custom message. I'm not forcing anyone to do so, but if you'd like to do that out of gratitude, that really helped grow the channel. And I will see you beautiful faces in the next tutorial. Peace.