5 Mini Python Projects – For Beginners
- January 4, 2024
- Posted by: MainInstructor
- Category: BASIC C Go Python Software Engineering
Video Title: 5 Mini Python Projects – For Beginners
Hello, everybody. Welcome to another YouTube video. So in today’s video, I’m going to be sharing with you five Python mini projects for complete beginners. Now, each of these projects shouldn’t take us longer than about 15 or 20 minutes to actually code out. What I’m going to be doing is
Giving you kind of a starting template for these. So I’m not starting with any code pre-written or anything like that. In fact, everything I’m doing here is completely from scratch. I don’t have any code on my other monitors or anything like that. And the idea behind
This is I’m going to show you my kind of thought process in creating these games, explain to you why I’ve written the code that I did and kind of how it works. And then that should hopefully give you guys a good idea how to go about extending these games and kind of
Customizing them to your liking. Now, as I said, these are for complete beginners. When I say complete beginners, I’m kind of referencing people that have a little bit of familiarity with Python have maybe looked at the syntax a bit, but aren’t quite comfortable yet are still considering themselves beginners
And kind of want some projects to work on. And some, I guess, things that they can use to actually apply their skills, rather than just looking at straight theoretical tutorials. So anyways, with that said, I hope you guys are looking forward to this. Let’s get into it after a quick
Word from our sponsor before we get started, I need to thank the sponsor of this video, which is Alco expert algo expertise, the best platform to use for preparing for your software engineering, coding interviews, and as the highest quality coding interview practice questions with 155 practice questions, detailed solutions,
And nine of the most popular programming languages, a feature packed browser-based coding environment, extensive test suites and conceptual overviews and code walkthroughs for each. And every problem algo expert is the best resource to use to ACE your coding interviews. Algo expert also has a data structures, crash course, coding, interview assessments,
Any mock interviews feature. I can highly recommend algo expert as a former customer myself and now an official instructor on the platform get started using algo expert today by clicking the link in the description and using the code tech with Tim for a discount on the platform. All
Right, so the five projects I have for you and in the order in which I’m going to be showing you them is a quiz game, a number of guests or game rock paper, scissors, choose your own adventure. And then finally a password manager. Now these are going in the order of
Difficulty. So the first one I’m showing you is the simplest. The last one I’m showing you will be the hardest, but the last one is still not going to be that hard. If you’re a complete beginner, you should still be able to actually code it out and understand what’s going on. Now,
If you guys want to skip to a certain project, you don’t want to go through one of them, whatever. There will be some timestamps in the description and kind of chapters on the video timeline. So feel free to skip through to whatever you want. And now what I’m going to
Do is quickly show us how we can set up our environment. And then we’ll get started working on this first project, which is the quiz game. All right. So right now I’m using something called visual studio code. This is known as an IDE, an integrated development environment. You
Totally do not need to use this if you, this installed and you know how it works, go for it. But for most of you, I’m going to recommend you something called ideally. So when you install Python and I’m going to assume you have Python installed at this point in time, what
You’re going to do is open up this app called ideally, if you’re on windows, you can search for it on the windows bar. If you’re on Mac, you can look forward in the spotlight search, which is in the top right-hand corner. So open up, ideally, again, this is installed by default.
When you installed the kind of vanilla version of Python, and this is going to bring up something known as the interactive shell. Now, this is not where he writes your code. I want to make that very clear. A lot of people make the mistake of writing all their code here.
No, don’t do that. What you want to do if you’re using this is go to file, press a new file. And now you have the place you’re actually going to be writing your code. So the first thing I recommend you do is save this file. So save it in a folder,
Save it on your desktop, wherever, and name it something right? Name it, like the name of the project quiz game, a choose your own adventure game, whatever I would recommend. You make new files for every one of the new projects that you are working on. And so I’ll just
Get, give you an example here. I’m going to save this as test up PI. And now if I go in here and I type, you know, print, hello, just some basic Python syntax. The way I actually run this code here is I press run and then run module. Or
Alternatively, I press the F five key and then notice, it’s going to bring up this interactive shell. It’s going to print out and run your program. And then you can go back here, modify it, save it. And whenever you want to run it, you press a five or press a run
And then run module. All right? So hopefully that gives you guys an idea how to set up your environment. Obviously feel free to download visual studio code as well. And we will link to it in the description or use any coding environment that you’re comfortable with and that you
Know how to use. So right now I have a Python file open. This is a file it’s on my desktop. Doesn’t really matter where you put the file. And the first thing I’m going to do here is start working on the quiz game. So this quiz game, the idea
Behind it is we want to ask the users a bunch of questions. And then if they give us the right answer to these questions, we’ll kind of add one to their score. Then at the end of the program, we’ll print out what they got out of the number of questions.
So if there was 10 questions, we would say, Hey, you got, you know, three out of 10 or seven out of town or whatever. And maybe we’ll even give them a percentage or something like that. So let’s get started. The first thing I’m going to do here
Is use the print command or the print function. I’m going to assume you guys are familiar with this, but when you want to print something to the screen, output something to the console. You say, print, you put some value in here. The value you typically put is a string. A
String is anything encapsulated in double quotation marks or single quotation marks. And then this’ll be what is outputted? So the first thing I’m going to do is just kind of welcome my users to the game. I’m going to say welcome to my, and then computer quiz. So the specific quiz I’ll
Go with is a computer quiz. Please feel free to go with whatever type of quiz that you want. All right, now we’ve welcomed the user to our game. Let’s just quickly test this out in vs. Code to run your code. You press this little lock kind of run button right here. You’re
Going to see it should open up a terminal here. And then notice notices says welcome to my computer quiz because the program just ranked. Awesome. So now what I want to do is ask the user. If they want to play my game, if they say, no, I don’t
Want to play. Then we’ll just immediately quit the game. So to do that, I’m going to create a variable. I’m going to say playing is equal to, and then I’m going to use this function called input. Now, what input allows you to do is ask the user to start typing
Something in, in the console. So inside of input in here, you put, what’s known as the prompt. Now the prompt is kind of what appears before the user can start typing. So for example, if you’re asking the user for their name, you may have the prompt be name and then colon, and then
Maybe a space. And then right here, after this space, the user could start typing whatever their name was. So in my case, I would put tint and then whatever they type after the prompt, and then when they press enter, that will be stored in plank. So if I
Typed him and then I press enter now playing will be equal to Tim because after the prompt, that’s what the user typed, uh, before they hit enter, right? Hopefully that kind of makes sense. And even if the user has a space, they say like, Tim and then are
All of this Tim space are, will be included in playing because this is all the stuff they typed after the prompt, before they pressed enter. So I’m going to ask them here. Do you want to play question mark? And then I’m going to add a space here. The
Reason I’m adding a space is because if I don’t add a space, then the user is going to start typing right on the question, mark. And that’s going to be kind of all smushed together and it doesn’t look nice. And so we’re going to add a space to make
Sure the user starts typing one space after the question, mark. All right. So now if I run my program, so I press the run button, it says welcome to my computer quiz. Do you want to play, notice the cursor is here and now I can start typing whatever I want when I press
Enter nothing’s happening. Cause we haven’t done that yet. We haven’t configured that. Uh, but that’s kind of the basics. That’s how you get user input. And just to show you here, if I print out playing what this will do is give me whatever the value of this variable is. So if I run
This here, it says welcome to my computer goes, do you want to play say yes. And then it prints out. Yes. Right? So pretty straightforward. Okay. So now that we know if the user wants to play or not, right, cause after this line is done, we’ll have something stored in
Playing. We want to check if the user typed. Yes. Right. And specifically if they didn’t type, yes, we want to end the program. So what I’m going to do is use something known as an if statement. Now, an if statement allows us to conditionally check kind of, uh, we’re compare
Values together and see if something is true or false. And so I’m just going to write out the kind of entire, if statement, then I’ll run through it. Step-by-step I’m going to say if playing does not equal two, so an exclamation point and then the equal sign. And then
I’m going to say yes. Then what I want to do is I want to quit the program. And there’s this function in Python that you can use called quit. And this will just immediately terminate the program. So what I’m doing is using, if I’m writing, what’s known as my condition, this is
The thing that I want to check. So I want to check if the variable playing, which is what the user typed in is not equal to. Yes. The reason I’m checking if it’s not equal to yes. Is because if they typed anything other than the word, yes, I want
To quit the program. Whereas if they typed, yes, I don’t want to quit. And so what happens here is we’re going to compare whatever the user typed in with. Yes. And since we’re using not equal to, if what the user typed in is not equal to yes. This condition evaluates to a
Bullion, which is known as true. And then if this is true, right? So if whatever the condition is is true, then whatever is indented. After this cool in here is going to be run. So hopefully that makes sense. I won’t go too much more into the syntax. I assume you guys can probably
Figure it out yourself. But the idea is you put a colon and then all the stuff you want to happen when this condition is true, you indent here and an indent is kind of four spaces. I’d recommend you use tabs rather than kind of going one, two, three, four. You’ll get some
Issues with your indentation. If you try to do spaces and taps. Yep. So, anyways, let you see this now, uh, let’s run this program. Okay. I’m going to say welcome to my computer quiz. Do you want to play? I’m going to type. Yes. And while the program is going to end, regardless,
Because we’re not doing anything after this, if statement, but if I go here and I print, okay. Uh, exclamation point and then let’s play smiley face. Um, oops. Okay. I need to fix my quotations here yet. Okay. That’s all good. Let’s run this. Now. It says welcome to my
Computer quiz. Do you want to play I’ll type? Yes. And it says, okay, let’s play. Right? And then it gives a really bad smiley face that I need to fix. And if we run this one more time and then this time we type no notice that it doesn’t say,
Okay, let’s play because this condition was true. And so the program quit. All right. So that’s about if statements, hopefully that all makes sense. I’m using a lot of if statements in this video. So now that we say, okay, let’s play. What we want to do is ask the user their first question.
And so what we’re going to do is the exact same thing we did when we were asking the user, if we want to play, we’re going to say some variable. I’m just going to call it answer. Cause that seems to make sense is equal to, and then input. And then I’m going
To put whatever the question is. I’m going to say, you know, ask something about a computer. I’ll say, what does CPU stand for? Question mark. And then what I’m expecting is that the user’s going to type in the answer. Right? And so what I’m going to
Do is just add a space here to make sure that again, the user’s not typing right beside the question, mark, they have a little bit of space. And now what I want to do is check if the user’s answer is equal to the correct answer. So I’m going
To say, if answer is equal to, and then I need to type out what the actual answer is now in this case, this is central processing unit. And I think I spelled processing, correct. Obviously you’re gonna want to make sure your answers are actually spelled correctly because even if the user types
In central processing unit, but they like forgot the G or they spell something wrong or they have like a capital P uh, they’re going to have the question. Mark does incorrect because the answer has to match exactly with what the user typed in. Okay. So now we have a colon
And now we’re saying, okay, well, if the answer was equal to central processing unit, what do we want to do? I’m going to print that. They got it. Correct. So I’ll say correct like that. And notice I’m using single coats and double quotes and kind of interchangeably. Uh,
It doesn’t matter which one you use so long as you consistent with the starting and ending quote. Awesome. So let’s just run this now and see if this works. So I’m going to press run. It says welcome to my computer game. Do you want to play? Yes. Okay. Let’s play what
To CPU stand for central processing unit. And then it gives me the, uh, the output saying correct. Now if I run this again, do you want to play? Yes. Okay. Let’s play. What a CPU stand for. I type in just CPU. It doesn’t give me anything because, well, this was not
True. Sweet. Okay. So now the thing is though, if the user gets this wrong, I want to tell them that they got it incorrect. Right? We need some output saying them saying, Hey, no, that was not correct. And so what we’re going to use now is what’s known as the L statement.
So whenever you have an if statement like this and you are checking if something is equal to something else, and that’s what the two equal sign is doing, or you have some condition here. If this condition here does not evaluate to true, you can put this L statement here, which means if
This is not true, whatever’s in the L statement will run. So if I go here and I say, print incorrect, exclamation point. Now, if this is false. So if the answer does not equal central processing unit, then we will print out incorrect. If we type anything, doesn’t matter. Just
So long as this right here, that we typed out as equal to false whatever’s in the L’s here will end up running. So let me just show you what I mean. And then we can talk about this a bit more. So let’s run. Do you want to play? Yes. Okay. Let’s play.
What does CPU stand for it? Central processing unit. And then it says correct. And ups. I should have typed in the incorrect one button. That’s fine. Let’s just type in no. And then notice it gives me incorrect. And if I ran this one more time type. Yes. And I typed some
Other random thing. It still gives me incorrect. So if I type anything other than central processing unit, the L statement runs. And again, the syntax for the L statement is you write else, you do a colon and then any stuff you want to run, you do indented after the L. So you
Can do multiple things as well. I could do another print statement. And then both of these print statements would run. Uh, if we got this question incorrect. Sweet. Okay. So now we have our first question and now what we can do is kind of just copy this to do the rest of
Our questions, right? So I’ll copy this, uh, one more time. We’ll do four questions for Mike whiz. Please feel free to do more. And it’s totally fine. If we want to leave this answer variable the same. I don’t need to change this to be something else. Uh, we could if we want
To, but since we are done using the answer for this question after this, if statement, it’s fine, if we use the same variable to store the answer for our next question. So now what we’re going to do is we’re going to kind of remove all of our answers and questions and we’re
Going to type in well new answers and new questions. And I’ll show you some more things that we can do here in kind of some fixes and all that as we go through, but let’s just get our questions done first. All right. So now my next question also, what does GPU
Stand for? Question mark, and then this’ll be, and I’ll copy this graphics processing unit. Okay. So let’s go graphics, processing unit like that. I hope that’s correct. And then the next question we can ask, um, Hm, Hm. I’ll just do a bunch of acronyms. What does Ram stand
For question mark. This will be random access memory like that. Okay. And then lastly, we can say, what does PSU stand for? Question mark. And we’ll just say power supply like that. Sweet. So now we’ve got all of our different questions here and we’re kind of printing out
Whether we got them correct or incorrect. So let’s just quickly test this out. Let’s make sure this is all working. So, uh, do you want to play? Yes. What does CPU stand for central processing unit? What does GPU stand for? Notice? I didn’t add the space here and since I didn’t add the
Space, you’re going to see when I start typing here. That’s kind of smushed with the question mark. So I’ll say graphics, processing unit. What is Ram stand for random access memory. Okay. And what does PSU stand for? Let, just type PSU in the nose that tells me incorrect.
So I’m going to start by fixing these spaces here. You guys saw what happened when I didn’t add the space for the input. So now it should be all spaced out properly. Sweet. So now we’ve got this all working. Hopefully you guys are all familiar with this. If in kind of L syntax.
Now I just needs to be in this structure whenever you have a colon, typically in Python, the next line after that does need to be indented. If I did this and like, I didn’t end on this line here, you can see we’re getting this red highlight. And it’s reason we’re getting that
Is because the indentations all messed up. This is supposed to be indented after we have the L statement and a small note, you can only have the L statement after an if statement, right? So I can’t just randomly come down here and put an L statement. It needs to come after an if
Statement appears. Right. So hopefully that’s clear. Okay. So now the one thing that I want to show you though, is that we might be getting some kind of weird results from our program that we don’t expect. So I’m going to run my program and I would say, do you want to play?
And I’m just going to type yes with a capital Y and notice when I do that, it doesn’t actually start my program. I didn’t immediately quit. And the reason for that is whenever you have a capital that is different than lowercase, right? So if you have, yes, that
Is not equal to, yes, these are different strings. And so if we want to check if the person’s answer, regardless of the case, right? If they have a capital Y or a capital E or a capital asset or something, or, you know, multiple capitals, if we want Y cap or capital Y capital
E lowercase S um, to be valid and to allow the user to play, we need to do something. Now, there is this method in Python called dot lower. And what dot lower does is it takes whatever text we type in, and it just makes it completely lowercase.
So if I go here and I print, you know, Tim is great like that. And then I say dot lower, and actually, let me do this in another way. That’s not as confusing. Let me say text is equal to this. And then I say, text dot lower, what this will
Do, and make sure you have the parentheses by the way, is it will convert all of this text to lowercase. So if I just run my program here and we have a look at our terminal, notice that, uh, wait, oh, I have to type some English, just type that it
Says, Tim is great all in lowercases. And so we can use this here to convert all of the answers that our user types in to lower cases. So I can say playing dot lower. And then if the user typed in something with capitals, it will just all be
Lowercase. And that way, if they type yes with any different casing, it will still evaluate to true, uh, because we’re converting it to lower. Now in the same fashion, there is this something called upper. If you say dot upper, it will convert everything into upper cases. And
So then what you would do if you’re using gut upper is you would make your answer in complete uppercases because, you know, you’re always going to be converting anything, lowercase to uppercase. So hopefully that’s clear, but we’re going to just throw down lower on here to all of our answers. So I’m going
To say dot lower. I’m going to say doll lower. We’re going to say doll, lower, going to say dot lower. And alternatively, if you didn’t want to do it this way, you could actually just do it at the end of this input here, you could say input dot
Lower, and then you can just remove this because now your answer is already converted to dot lower. So you don’t need to convert it kind of in this condition right here. Okay. Hopefully that’s all clear, but yeah, that just taking your answer, converting into lowercase, and then you’re checking.
If the lowercase answer is equal to, well, the lowercase answer you actually have. All right, so let’s rerun this. I’m going to open up my terminal going to run. Do you want to play I’m to type yes. With a capital Y notice this works now and now I’m going to do some capitals.
So central processing unit that works right. GPU graphics, processing unit, and then you get the idea. I won’t do the rest of them. Okay. So the last thing I want to do here is implement some notion of score, right? We want to be able to tell how many questions are
Users got correct. So what I’m going to do is make a variable here at the top of my program, I’m going to say, score is equal to zero. This is going to allow us to keep track of how many correct answers they have. Now, all we have to do here, since we
Define score equal to zero is every time the user gets a question, correct? We just need to increment score. So add one to score. So inside of this, if statement here, because this is if the user got it correct. Right. I’m going to say score plus equals one. What that says,
Okay. Take the value of score and add one to it. That’s equivalent to saying score is equal to score plus one. So hopefully that’s clear, but that’s a way that you can just add one to the variable. And so if we add one to score every time we get something correct,
That means that at the end of our program, we’ll have some number, right? We’ll have two, three, zero, whatever, however many questions we got. Right. And we can then use that to display how well the user did. So I’m going to just say score plus equals one. I’m going to do
This inside of all of these, if statements here. Okay. And now we’ve added one to score. So now what I can do at the very end of my program, once we’re done of our questions is I can say you got, and then I need to use a plus sign. This is a
Concatenation operator. I’ll discuss this in a second score, plus, and then questions, correct? Exclamation point. But I need to convert this to a string. So let me go through what I just did here. Okay. So I said, you got, I did a space notice I manually added this
Space here. I then had a plus sign. And then I said, string score, and then plus questions. Correct. So the reason I’m doing this string here is because score is a number, right? Score is an integer. It’s not a string. And so if I tried to do something like, you know, Tim
Plus one, well, this doesn’t really make much sense, right? Because I’m trying to add a number to a string. And like, how do you add one to text? That’s just an undefined operation that doesn’t exist. So what I need to do instead is convert this one to a string
Because now that I have two strings, when I add them together, what I get in Python is Tim one. Right. They kind of get combined. And so that’s what I can do. I’m going to convert this score here into a string. So then when I add it to the
Other strings that I have here, it’s valid, this operation works and I’m not getting, uh, some issue popping up. Okay. And then I’m adding the questions. Correct. So I’m kind of putting this string score in the middle of the string. Right? You got whatever the number is questions. Correct. Okay. So
Let’s run this and you want to play. Yes. I’m going to say, let’s see, BU stand for central processing units. Okay. Graphics, processing units. Okay. PSU Ram. And it says incorrect. You got two questions. Correct. Right now it’s giving me how many questions I got. Correct. And so
The very last thing we can do here is we can copy this line and we can give them kind of a percentage, right? Like you got 50% or you got whatever percent. And the way we do that is now we’re just going to take our score. We’re going to divide it
By the number of questions that we have is four. And then we’re going to multiply all of this by a hundred. Right. And if we want to be extra clear here, what we can do is put parentheses around this score over four to make sure this operation happens
First, before we multiply by a hundred. But you’ll see if we did it the other way round. We didn’t add the parentheses. It would still work fine because we would do the division before we did the multiplication. But anyways, we’re going to say now, instead of you got questions,
Correct, we’re going to say you got, and then we’re just going to add a percent on here. Now, notice I’m not doing a space and since I’m not doing a space, it’s going to be whatever this number is. And then plus, and then the percent sign. So it
Will come right after, and then we can do a period. So now calculated the, uh, the percent, again, just taking the score, dividing it by our number of questions, which is four, and then multiplying it by a hundred. Now note here, if you change number of questions, you got to change this number,
Right. So let’s go here and let’s run this and let’s go to our terminal. Yes, we’ll play. Uh, I’ll just type something random. Okay. Random access memory. Correct. And then power supply. And then it says you got 50%, you got two questions. Correct. And with that, that is going to wrap up
Our first Python mini project. So I know I went really slowly through this and really explained everything in depth. That’s cause this is the very first project I’m trying to make sure this video works for everyone regardless of your skill level. And now I will go a little bit faster. I won’t,
Re-explain a lot of this syntax that I’ve already explained now, as we move into the new projects, just anything new that I kind of come across to that we use, uh, I will explain, but this, our first project, this is the quiz game. It will be some
Code that has, or there will be a link story that has this code in the description. If you want to download this yourself, but I would highly recommend you modify this, you know, change around, maybe add like more than one point for questions that are worth, you know, more than one
Point that are more difficult or something like that. Right? And you guys can do this as you please, regardless that is the quiz game. Now we’re going to move on to do a number guesser. I think this is the one I was saying I was going to do second.
So this one is pretty straightforward. What we’re going to do is generate a random number and we’re going to track how many times it takes the user to guests, this number. And so what I’m going to do is zoom in a bit here so that we can see our
Coat. The first thing I’m going to do is import this module in Python called rent. All right. So first thing to mention here is that this right here is what’s known as a module. So when you import random, you’re importing the random module. Now this just lets you use all of
The functionality that’s kind of in here. This is default. This is installed by with Python, by default. You don’t need to install it or anything like that. In quick note, there is modules that are built by, you know, people like me or other developers out there and you can
Import them. Uh, but you have to install them first. This one is just built into Python by default. And so no installation is required. Anyways, let me show you how to make a random number. So there’s a few different ways to do this, but the two simplest ways are to do
Random dot and then Rand range. And then you’re going to do an open and closing parentheses. And let me get rid of the print statements so we can see this better for right now and here. You’re going to put the start and then the stop of the range
For your random number. So you would do something like negative one. If you want it to start the range at negative one and stop at 10, excuse me. You know, what this would do is generate a random number that goes from negative one to 10, but does not include 10. So that’s very
Important. The number you put here is the absolute upper bound. You cannot have the number 10 be generated. If 10 is here, if you wanted the range to generate a number between negative one and 10, you would have to put a left again. I don’t know why they do that.
There’s just some things in Python that aren’t necessarily intuitive for beginners. But with this is 11, it’s not going to generate 11. It will generate up to 10. So make sure that’s clear. Now there’s another thing you can do here. If you want the range to just start at zero, you
Can say random dot Rand ranch, and just put the stop. If you just put one thing here, what this will do is generate a random number between zero and this number minus one. So up to 10 and yeah, there you go. That’s how that works. Uh, okay, so let’s do something from
Negative five to 11 and let’s say R is equal to random dot Rand range and let’s just print R okay. So let me run this and we’ll look at our thing here. Okay. Run and notice we get a five. Now, if I run this again, we’re getting a negative three. I run
A bunch of times. We get a bunch of random numbers. You see, this is random and there you go. That’s working. We got a nine. We can just round a bunch of times. We got a 10 notice. We won’t get 11. If we do this sweet. So we’re getting a random
Number. So that’s one way, another way to do this is with a function called Rand int. Now, Rand, it works the exact same way as rent range, except now it will include 11. So the upper-bound range now includes the number that you typed doesn’t go up to, but not
Included. So now if I do negative five to 11, 11 will possibly be generated. So if I run this now, uh, we get six, right? And we, if we keep running it, we might see that we get 11. Um, okay. I’m not, this could take a while. Yeah, there
We go. So we do get 11. That works. Okay. Sweet. Uh, and same thing here. If you decide to not include the start, it will just generate up to, and including this end number that you put right here. So that’s how you make a random number. So what we
Want to do is generate random numbers. Actually, let’s, let’s leave this here. Let’s say random underscore number. And then we want to ask the user to guess this number and every single time, they guess it, we’re going to tell them if they were above or below the number so that they
Can do it in like a reasonable number of guests, especially if we make this number like really large, right? So the first thing I’m going to actually ask the user is how large of a number they want to generate. So we’ll assume it starts at zero and
Then we’ll ask them to type in a number and, uh, we’ll generate up to that number. So I’m going to say, um, let’s say top of range is equal to, and then input and we’ll say type a number. Won’t even tell them what it’s for. We’ll just say
Typing up. Okay. So now they can type a number. So what we actually need to do here is we need to make sure that this thing they typed in here is a number, because if the user types in like hello or Tim or some random strings, something, that’s not a number, then we
Can’t use that. Right. And we also need to make sure the number they type in is greater than zero. So I’ll show you how we do that. I’m going to say if the top of range.is digit, okay. And then I’m going to do an if statement inside of this, if
Statement, I’m going to say if the ins and actually we’re going to do this, we’re going to say top of range is equal to int top of range. And let me pause here and explain what I’m doing. So, first of all, uh, you can make a variable using underscores. When
You want to have multiple words, it makes a lot of sense to make the name with underscores. So like top underscore of underscore range, you can’t have a variable, it’s like top range. That won’t work. You need to have it connected. You can’t have like two separate words
Like that. And he was this equal to input. The user is going to type something in now, by default, when the user types something in it’s going to return it to us with double quotation marks. So it’s going to be a string. So even if the user types in like, twenty-five,
It’s going to be returned to us like this and this here for Python is not considered a number. It’s not considered an integer, it’s considered a string. And so we need to convert this 25 so that it looks like this. So that’s actually a number. And the way you do that
Is you use this function called int. So you surround the string with int and then it will convert this string into its numeric representation. So it will give us 25. However, if you try to convert something, that’s not an actual integer into an end, it’s going to fail.
You’re going to get an error. And so we need to make sure that what the user typed in is a digit before we try to convert it into an it. And the way you check that is with this is digit method. So I say, if top of range.is digit, what is digit
Will do is return to us true. If this is a number, otherwise it will return false. And so if this right here is true, we will convert top of range into an integer. So top of range, equal to end top of range. Then we will check if top of range is
Greater than zero. So we’ll say if top of range is, uh, actually we’re going to say less than zero, less than, or equal to zero specifically, then what we will do is we’ll print out, please type a number larger than zero next time. And then we’ll just quit. So we’ll tell them
What they did wrong. And then we’re just going to quit the program right there. Otherwise if we make it through all this, we’re good. But one thing we need to do here is we need to put an ELs and we need to put quit, and we need to put a print
Statement that says, please type a number next time. So let me run through this. What we’re doing is checking if it is a digit, if it’s not a digit. So in the L statement, we need to tell them, Hey, you got to type in a digit. It doesn’t work. If
You don’t type in a number, right? And then we quit. Now, if that works, if it is a digit, we convert into an ENT. We make sure it’s greater than zero. If it isn’t, then we tell them, Hey, you got to type in a number and then we quit. But if we make
It through all of this and we don’t quit. So we’ve now converted the number to an ENT. We can now use that number to generate our random numbers. So we can say random number, random dot ran int. And then we can put top of range as our variable for generating that random number.
And we’ll now generate up to whatever number they typed in. Sweet. So now that we have that, let’s just print out the random number and let’s just test this and make sure it’s all working. So I’m going to run this type number let’s type five. And we got one issue, random ain’t
Missing one potential argument B. Okay. So this is my fault. I was saying, when we used rent int we could just include the top of the range. That’s false. We need to include the bottom of the range as well. So I’m going to put zero there and now this should work. So
Let’s run this and let’s type a number let’s type five. And there you go. We generate a random number, which is four. If we run this again, type five, we get three. You can see this is indeed working. So it’s. So now that we have our random number,
We want to keep asking the user to type in a gas for the number until they get it correct. And so I’m going to use a wild loop here and I’ll explain how this works in a second. I’m just going to say while true. Now what this means is, okay, we’re
Going to do whatever is indented after this wall up here after the colon, while this condition whatever’s at the top of here is true. So right now, if we just decided to like print Tim, this would happen infinitely. This loop would never stop unless we actually like manually close the
Program. The reason is because there’s no way for this to end, right? I say wild true. Well, true is always true. And so we’re just always going to print 10. However, if we, there is this keyword it’s called break. And what break will do is immediately stop the loop. As
Soon as this line of code is executed. So what we can do is use this break keyword to break out of the loop, stop running the loop as soon as the user types in the correct number. So we’re going to say while true, this is the condition for the wild loop. We
Could do a real condition. We could say something like, wow, um, like input. And actually it will say like user yes is not equal to random number. We could do something like that. That would work as well. But I want to show you using the break keyword. So instead we’re going
To do while. True. Alright. So what we’re going to do is we’re going to start by asking the user to guess what the number is, right? That’s the very first thing we do every single time we ask them, we say, okay, make a guess. So I’m going to say a
User underscore guests is equal to, and then input. I’m going to say, make a guess. Cool. Now, same thing here. We need to check if the user’s guess is actually an integer, right? And so I’m going to copy exactly what we just did right here. And I’m going to paste it down
Below. And I’m going to say, okay, if the, and now, instead of saying top of range, I’m going to say user underscore guests dot age is digit. Then user underscored guests is equal to int of user underscore guests. And then I’ll even take this and we don’t need to track of the
Numbers lessons year. That’s fine. Uh, we can just do this. So I’m going to say, and I’m going to get rid of this, this Quip, okay. Let me explain this. But what I’m saying is, okay, the user guests is equal to input, make a guest. They’re going to type in some numbers.
This comes in as a string. We need to make sure that what they’ve typed in is actually a number. If it is a number, it will convert it to a number. We’re all good. However, if it is not a number, then we’re going to say, please type a number next time. And we’re
Going to use this keyword called continue. Now what continual do is automatically bring us back to the top of our loop. So it’s a little bit different than break rather than ending the loop. It just brings us back to the very top. So if I did something down here like printed
After continue, if we hit this, continue keyword, this won’t run. We won’t print. We’ll just go back up to the top of the loop and ask the user to make another guess. And so that’s what we’re going to do. However, we’re going to come down here. Now, we’re going to say, if the
User guests is equal to the random number, we’re going to print and we’re going to say you got it. You got it. Correct. Otherwise we’ll say else, print, you got it wrong. So if they didn’t get it right, they got it wrong, obviously. Right. Whereas if they didn’t type a number, we’ll
Just say, please type a number next time. And then we’ll continue rather than doing this and telling them they got it wrong after they didn’t even type a number in. Okay. Hopefully that makes sense. We can test this out though and make sure it’s working. So save
The program and run now type a number. Let’s type a number. Let’s say 10th. Okay. Make a guess. We’re going to guess three and wow. Okay. We actually got it. Um, that’s great. But notice that it’s still asking us to keep making guesses and to quit this, you can type control
C on your keyboard. If you get into an infinite loop, the reason it’s telling us to do that is because we didn’t break out of the wild loop. Right? We said you got it, but we didn’t stop. And to stop. We need to use the break keyword. So now
You’ll see if we do guess it will immediately stop looping. Whereas if we don’t get it, we will continue looping because the brake keywords not here. So let’s run this now. Type a number. Let’s just go up to five, make a guess one. You got it wrong. Okay. We’ll guess too.
You got it wrong. Three. You got it wrong. Four. You got it wrong. Five. You got it. Sweet. And then we exit the loop. There you go. Okay. So that’s working fine. Now what I’m going to do is I’m going to keep track of how many times the
User actually makes a guess. So to do this, I’m going to make a variable similar to what we had with score before I’m going to say guesses is equal to zero, and now every single time we start this wild loop again, I’m going to increment add one, two
Guesses. So I’m going to say guesses plus equals one. So at the very top of the loop, we’ll increment guesses. So the first time this runs guesses will be equal to one. We’ll go through all of this. Then we’ll come back up to the top. Guesses will
Now be equal to the usual. Now make another guest. And now when we exit this wall loop, once this is done, we’re going to print out how many guesses they got. And I’m going to show you a different way to do this system. I’m going to say you got it in.
And then we’ll say comma guesses, and then the string guesses. So another way to print multiple things on the same line is to use commas. So I’m going to say you got it in. And then I’m going to say whatever the number of guests is notice. I don’t need a space here.
Whenever you have a comma separating your different things that you’re printing out, it will automatically add spaces in between them. And then notice here, I didn’t even convert this to a string. And that’s because the print statement is smart enough to say, okay, Hey, this is an ENT. I’m going to convert
This into a string for you and kind of automatically add it to this string. So what we were doing manually before the print statement can just do for us. And so this time we’ll let the print statement do it. Uh, this line here is completely equivalent to just having the,
Uh, the plus the space, the string, uh, the other plus and the space, right? It’s the exact same thing. Okay. So let’s go back to what we had and there you go. We are all good. Now let’s just run this. And I am going to show you how we can
Tell them if they got it, uh, greater than, or less than. Cause I did tell you that we were going to do that. Okay? So let’s run this and let’s say type a number. Let’s go five, make a guess one, you got it wrong, two, you got it. And then
It says, you got it in two guesses. Sweet all is working. So now the last thing we want to do is tell the user if they were greater than, or less than the number so that they can kind of narrow down their guesses. And so, rather than just telling
Them, you got it wrong. Now, inside of the L statement, we’re going to check if the user was above or if they were below. And there’s a ton of different ways to do this. I’m just going to do it this way. I’m going to say if the user guests is greater than
The random number, then what I want to do is say print. You were above the number exclamation point. Otherwise I’m going to say print, and I’ll say you were below the number. All right? So let’s run through this. We’re just checking. If the user guests is greater than whatever the random number is,
If it is we’re going to tell them they were above the number. Otherwise, if it wasn’t greater than it must be less than. And we’re going to say you were below the number. Now some of you may have heard that statement. If it wasn’t greater than it must be less than you
Say, no, it could be equal to that’s correct. But the thing is up here, we checked if it was equal to. And so if it was equal to, we would have gone into here. We would not have hit this L statement. So if we’re in this L statement,
We know we must not be equal to the random number. And so instead, what we can do is just run this. If statement that’s inside of the ELs, I’m going to show you more elegant way to do this in one second. Let’s just run the program and see if this
Works now. Okay. Let’s run this type of number let’s type 20. Make a guess. Let’s guess 10. You were above the number. Okay. So now I don’t have to guess below 10. So I’m going to guess five. You were above number of kids less than five, four,
Three, two, one. You got it in nine guesses. Okay. So anyways, that did work, but it was telling us whether we were above or below. Uh, let’s see if I can get something that’s actually, I guess I couldn’t have guessed anything below one. So let’s run this again. Let’s type 10 let’s
Guess one. And then this time it is telling us we’re below the number. Okay, great. So that is working. Okay. So the one thing I want to show you here is how we can clean this up a little bit, using something new that we haven’t seen yet, which is known
As an Elif statement. So an Elif statement is something that kind of happens after the initial, if statements check. So I’m just gonna type this out and then I’ll show you how this works. So I’m going to say Ella. Okay. So now what I’ve done is I’ve made this code a little bit
Cleaner and the way I’ve done this, as I’ve removed, that kind of nested, if statement that we had, and I’ve now implemented an LF instead. So what the LF does is if the initial condition is not true, it will then check a another condition. So it says, okay, if this is true, we’re
Going to do this. We’re going to skip all of this. If this is not true, we’re going to check this. If this is true, we’re going to do this and we’re going to skip whatever else is after it. However, if this is not true, then we’re going to do whatever
Is in the else. So we’re going to check this, if it’s true, we do this. Otherwise we check this. If it’s true, we do this. And otherwise, if both of these things are false, we do what’s in the ELLs. And so that’s just another way to do this rather
Than having what we have before, which was the Ellis. And then all of this kind of indented in the house, right? This just cleans it up and small note. And you can have as many Elif statements as you want. So I get out another one like this, if I
Want to do that. But in our case, it doesn’t really make any sense to do that. Okay. So that’s actually it, uh, I’m not going to run the program, just believe me, this, this does work and yeah, that is going to be our number guessing game. So
I’ll zoom out a bit. So you guys can kind of see all of the code, but that is how that works. I guess there’s not really much more to say about that. And now we’ll move on to the next one. All right. So now we’re moving on to rock paper scissors. Now,
Obviously you guys know how this game works, but what I’m going to do here is make it so that the computer keeps track of how many times the user gets it. Correct. Versus how many times the computer gets it. Correct. When I say correct, sir, I mean, whoever wins a rock paper
Scissors. So the first thing we’re going to do here is import random. I know small note here, when you are importing modules, it’s typically best practice to do at the very top of the program. I see some beginners import the module, like right before they use it. That’s fine.
You can do that, but it just a better practice to have it right at the top. So it’s really easy to see what stuff you’ve imported and obviously remove it. And then you can use it throughout the entire file. Whereas if I tried to use like random up here, ah, it doesn’t
Work until after I’ve imported. Right? Uh, so hopefully that’s clear, but anyways, that’s what we’re going to do. So what we need is we need two variables, one for the user score and one for the computer score. So I’m going to say user underscore wins is equal to zero. And I’ll say
Computer underscore wins is equal to zero as well. All right, now I’m going to have a wallet. I’m going to say, well true. And the first thing I’m going to do here is I’m just going to ask the user, uh, actually, yeah, I’ll ask the user to input, rock paper, or
Scissors, and then I will also let them typing Q uh, like the letter Q. And if they do Q, then we’ll just immediately quit the program. So let’s handle that first. Let’s say user underscore input is equal to input and I’ll say type, and then we can say rock slash paper slash scissors
Is scissors with a, with, with two S’s. I think that’s how you spell it. Okay. Rock paper, scissors. And while paper should be spelled correctly. Okay. Rock, paper, scissors, or Q to quit. Okay. All right. So now that we have that, we will go down and we will check. Let me
Just zoom out so we can see this here, what the user actually typed it. So the first thing I want to do is I want to see if they typed in queue. So I will actually convert this to dot lower in kind of the way that I showed you. We could do a
Previously we’ll take whatever the user types in, and we’ll just convert it to dot lower. And actually instead of a period, let me do a colon and let me add a space. So it’s not all smushed there. Okay. So type rock, paper, scissors, or cute to quit. And now I’m going to
Say if B user input, and this is converted to dot lower, right. Is equal to Q. Then what I’m going to do is I’m going to quit. Otherwise, I’m going to check if they typed in rock paper scissors, or if they type something else. And now I’m
Going to show you how we can check if the user input is equal to more than one thing, because previously I’ve been showing you how we can check if it’s equal to just a string. Right. But now I’ll give you a little bit of a, I don’t want to call it a hack,
But a little bit of a trick so that you can see if the user typed in rock paper or scissors all in one line, rather than writing three, if statements. So I’m going to say if the user input is in and I’m going to use a list, you guys probably
Haven’t seen this before. If you’re a, like a complete beginner in Python. And let me just kind of fix this a little bit. So P S I’m going to type in myself and I’ll explain what’s going on here. Okay. So let’s make this quotes. Okay. And then this needs to be
In quotes too. Okay. I’m really messing this up quite badly, but you get the idea. Okay. So what I’ve done is I’ve just created a list. Now, a list is anything encapsulated in these square brackets, um, that is like separated by commas. So I have this rock paper and scissors
String in this list. And so what I’m saying is if user input is in this list, I’m checking if whatever the user typed in exists in either of these three strings. So essentially we’re just checking if the user typed in rock paper or scissors, now you can put any strings in here
That you want, but we’re just checking, obviously, if this is in here and that’s how we can check multiple things on one line. There’s other ways to do this too, but this is kind of one nice trick that we can use. So I’m going to say if user
Input and I’m actually going to say is not in now, this is another key word again, that you may not have seen before. What this is going to do is simply reverse the kind of thing that we were checking before. So we were checking if the user input was in rock paper scissors.
So now when I say not in, I mean, obviously as you would read in English, this is checking. If the user input is not in here, if it’s not in here, that means I didn’t type in something valid and well, what we need to do is have them
Type in something valid. So what I’m going to do is say type continue here. And what this will do is just re ask them to type in rock, paper, scissors, or acute. So we could give some error message saying that’s not a valid option or something like
That. But what I’m going to do is just have it. So it keeps asking them to type something in until eventually they give us something valid. So when I hit continue, that means anything after here is not going to happen, right? If this continue is hit, we’re just going to go
Back up to the top of the wallet. Sweet. And actually rather than saying, quit here. What I’m going to do is save break. So this will break out of the while loop. And then that will actually automatically end the program for us. Cause we’ll be at the end. Uh, we won’t need
To, what do you call actually manually quit? So the break breaks out of the wallet, which means we’ll go to whatever the end loop is done or wherever the wallet is done. And then we can actually just print something saying, you know, good. No, that’s not. That’s a goodbye exclamation point. Sweet. Okay.
So now at this point in time, the user has given us, found him they’ve typed in rock paper scissors. So what we need to do is generate a random number that represents rock paper scissors for the computer. So I’m going to say Rand, uh, actually say, yeah, random underscore number
Is equal to, and then this is going to be a random dot Rand int and we’ll generate a number between zero and two. So if they type in zero, that can be rock. If they type in one that can be scissors R or paper they type into that can be scissors. So
Let’s write that down in a comment, uh, to do a comment in Python, you hit the pound sign or use the pound sign, like the number sign, and then type anything after it. Anything on a line that comes after a pound sign will not be read by your Python interpreter. And it’s
Just there. So that as programmers, easier to read and gives you like, you know, documentation or comments about what’s going on. So I’m going to say, rock is one or rock is zero. I want to say, paper is one MSA scissors is and then to switch.
So the way that I’m going to do this now is I could do an if statement or I could write three of Simmons, say, you know, if random number is equal to zero, then the computer picks rock. If random numbers equal the one, if random numbers equal to two, I
Actually don’t need to do that. What I can do is, uh, Hmm, let’s see here is what I’m going to do now here to actually assign, uh, some variable equal to rock paper scissors to represent the computer’s kind of choice is I’m going to use a list. Now, again,
This might be a little bit confusing, but I think you guys will get the idea. If I do this, I’m going to take this list right here, rock paper, scissors. I’m actually going to store it in a variable. I’m going to say options is equal to rock paper scissors, and I’m
Going to change this here to be options. So this is the doing the exact same thing as before, except we’re just storing this list of values now in this options variable. Now, if you haven’t seen lists before, these are actually very interesting. They’re known as a data structure and they are
Collections of elements, right? We have multiple elements, multiple strings stored in this list. And well, the way we access these different elements in this list, let’s say I just wanted scissors, or I just wanted paper. I just wanted rock is we use what’s known and known as an
Index. So if you write the name of your list, which in this case is options, that’s the variable storing the list. You can put these square brackets and then you can put a numeric index that represents these different elements. So in this case, the different indices of this list
Are zero one and two. And if we had another element, right, let’s just go, you know, test. Then this would be index three. So the way this works is you start counting at zero and then you just go up by one every single time. So the very first element is indexed by zero
Second, one third to fourth three. And so that’s all that is. So when I say options at zero, that’s going to give me rock. When I say options at one, that gives me paper. When I say options, add to that gives me scissors. And so I have some random number that’s between
Zero and two, right? And zero represents rock, one represents paper and two represent scissors. Let me get rid of test. So what I can do is say, uh, let’s actually change this here. Say computer underscore guess, or computer underscore pick, I guess is equal to, and then this is going to be options
At whatever the random number is, because this will be between zero and two. And so we’ll use that as the index to actually access the string. The thing that the computer chose, right? Rock, paper, or scissors. So now what we can do is we can print out what the, uh, computer chose. We
Can say computer picked, and then we can say comma, and we can say computer underscore pick. And then we will decide who actually won. Right? So then we’ll say, who won? Let me just do comma. Uh, actually let’s do plus, and let’s just add a period. The reason I’m not doing
A comma. And then the period is because of video a comma, it will automatically add a space between this period and the computer pick, which I don’t want. And so instead, we’re just going to add the, uh, the.like that. Okay. So we’re going to say the computer pick that, and
Then we need to decide who won, right? And so to decide who won, we need to all compare, uh, the user’s pick to the computer’s fixed. So we’re going to say if the user input is equal to, and then I guess we’ll say rock we’ll then do kind of the
Winning condition for the user. So if the user picked rock, then what do they win against? Well, they win against scissors. And so now we need to check if the user picked rock and the computer picked scissors. So what I’m going to do is use this keyword called and, and
Say, computer underscore pick is equal to, and then scissor. So if that’s the case, we’ll print out a U one exclamation point. And then we will say, user underscore wins plus equals one so that they get one more win. So what this and does is it checks if the condition on the
Left side and the condition on the right side are true. So what happens in this, if statement or what’s in this, if statement will only happen, if both of these things are true, pretty straightforward, that’s how the end works. Alternatively there’s an, or, and an we’ll kind of do
The opposite. We’ll check if either the left or the right is true, or both of them are true. If any of those three things happen, this is true. This is true. Or both of them are true. Then what’s in the, if statement will run. Whereas with the end,
It has to be both of these being equal to true for what the, what in the, if statement is going to run, or if what’s in the chef’s name is going to run, sorry, butchering my English. Okay. So that’s one of the wind conditions for our user. And
Then if that’s the case, we can just go ahead and say, continue. And we can go back up to the top of the wild loop and keep going, but we need to check the other wind conditions, right? And there’s two more wind conditions. Let’s go here and let’s fix the indentation. Okay.
Uh, and we’ll say if the user input now is equal to paper and the computer picked, uh, what is it rock then? That means that we won. Right? And so we would add one to the wind. And then the last one is we picked scissors and the computer picked paper.
Sweet. So the reason I’m doing this continue here is because after we’ve determined that we’ve won, there’s really no point in checking these other if statements. So we could instead do these in F’s. So I could say if Elif, Elif, and then actually I could remove all these
Continues. And in fact, let’s do this, and then we will go down here and we will say else. And then what we would do here is say print, you lost. And then we will say computer wins. Okay. Plus equals one. So the reason this works now is because we
Check. If we won with the rock versus scissors, we check what we won with paper versus rock. We check what we won with scissors versus paper. And if none of those are true, that means we didn’t one win, right? There’s no point in checking if the computer beat us and all the
Other scenarios, we just need to check. If our three wind conditions were true. If they’re not true, then we know that we lost. And so we would print. We lost. And then we add our computer wins. And this is an example of using multiple LF statements. We’ll check this
One. If it’s false, we’ll check this one. If it’s false, we’ll check this one. If it’s false, we run this. If any of these are true, we immediately stop. And we do whatever is inside of here, uh, which is increment, the user wins and print you one. Great. So the last thing I’m
Going to say before I do goodbye is I’m just going to print out the number of user wins versus computer wins. So I’m going to say the user, or I’ll say in this case, you, you, one comma, user underscore a wins times, and then we’ll print the computer one. And then computer
Underscore wins times, period. Great. So hopefully that is all good. Let’s quickly run through what we’ve done, because we wrote a lot of code here relatively quickly. As you can tell, I’m kind of picking up the pace a little bit as we go through this. So we have our
User wins. Our computer wins. We’re importing random, which we’ve already discussed. We have our list. First time we’ve seen this called options has our three values in it. We have wild, true. We have user input equals input, and then we say type rock, paper, scissors, or cue to
Quit. We make whatever they type in lowercase. We check if the user input queue, if they do, we break, we’re done. We stopped the program. If they didn’t, then we check. If the user input is not in the options. If it’s not in the options, that means they didn’t type a valid rock,
Paper scissors. And so we press, or we go continue, which means we’re going to start the loop again. We’re going to ask them to type something in. Then what we do, if they typed in something valid is we generate a random number between zero and two. Uh, this is the, like, what
It stands for rock is zero papers. One. So there’s this too. We make our computer picks. So computer pick is equal to options at whatever the index is of the random number. We then say, okay, the computer picked this. We then check if the user one based on what the computer
Picked. Right? And, uh, yeah, that’s all good. And then we increment computer wins or user wins and we will keep going until eventually the user hits queue. Once we’re done, we’ll break out of the wall loop and we’ll print these three things. Let’s run it. Let’s see if it works. Okay.
Type rock, paper, scissors, or cute acquit. Let’s just test queue. Okay. You want zero times and computer ones are your times. Goodbye. Nice works. Okay. Let’s actually type something. Let’s go rock. It says computer picks scissors. You want nice. Okay. Type rock, paper, scissors, or queue to quit. Let’s go paper, uh,
Computer picks scissors. You lost. Okay. That sucks. Let’s go. A scissors, a computer pick paper. You want? Nice. Let’s go rock. Okay. And let’s go cute. And then associate computer one, one time. You won three times. Good bye. All right. So that is rock paper scissors, keeping track of how many times would
The user and the computer wins. Now we’re gonna move on to the next project, which is the choose your own adventure game. All right. So this next project is one of my all time favorite beginner projects. And that is because it’s so customizable. There’s so much you can do with
This. I’m really only going to talk about this for about five or 10 minutes, because this is up to you guys to make this kind of as big as you want. So this is a choose your own adventure game. And I guess the best thing to relate this to, if you
Haven’t heard of this before is kind of these children books. And actually they have books that aren’t children’s versions too, but they’re kind of like pick your own storybooks where you’ll go to a page. And it will say like, if you want to go left, turn to page
42, if you want to like swim across the river, go to page 97, whatever. And then like, it kind of brings you on all these different paths throughout the book based on decisions that you make. So same thing here, we’re going to ask the user to make a bunch of different choices.
We’ll start with something simple. Like, do you want to play the game? Right? And then if they say, yes, we’ll say, okay, you know, you come to some bridge, do you want to cross it? Or do you want to swim underneath it? And then based on what they say, if they cross the
Bridge, maybe we’ll say, okay, you come to a dead end. Do you want to turn around? Or do you want to search the jungle? Whatever. Like, you can be as creative as you want. I’m just coming up with stuff at the top of my head. But then if they had
Instead decide to swim under the bridge, maybe we say like, oh, you know, there was a crocodile and your, your journey ended, whatever. So you guys can make it as complex as you want, but I’ll show you like the basic structure and kind of the nesting of statements and how it
Works. So the first thing we’re going to do is I’m actually going to ask the user for their name. This is one, this something I don’t usually do, but I think this will be cool. So I’m going to say, um, name is equal to input. I’m going to say type
Your name, colon, and then I’m going to say current, and I’m going to welcome the user. I’m going to say welcome comma name, comma to this ad venture exclamation point. And then we’ll actually get right into it. And before I even ask them, if they want to play, what I
Will do is I will just say like, awesome. For choice, we’ll say you come to a dirt road or something, do you want to go left or right. Or whatever. So the first thing I’m going to say here is answer and lower cases is equal to input. Um, and I’ll
Say, Hmm, you are on a dirt road. It has come to an end and you can go left or right. Uh, and then I will say, which way would you like to go question mark? Okay. So let’s just go here and notice that it’s doing this auto formatting. You guys
Don’t have to worry about this. Just my IDE auto formats, my code when I save it. And so you can see it’s kind of going on a new line. Uh, don’t worry about it. You can just do yours in the same thing. But anyways, that’s like my prompt, you’re on a dirt
Road. It has come to an end and you can go left or right. Which way would you like to go? And I’m expecting them to type in left or right. So the first thing I’m going to do is I’m going to check if they typed left or right. I’m going to say if
Answer is equal to left. And I actually, before I do that, I’m going to convert this input here to dot lower. And I realized I kinda messed something up, hopefully that fixed it. Okay. So we’re going to say dot lower. And let me add this space here between the question mark. Okay.
So answer equals equals left. So if the answer equals left, then we’ll do something else. Otherwise, uh, we will actually, it will say LF answer is equal to right. And then else we’ll say, uh, print, not a valid option. You lose. So I’m just going to make it. So if they
Ever give us something that’s not valid, they just immediately lose the game. Okay. So if the answer is equal to left, then we need to pick what’s going to happen when they go to the left. If the answer is equal to right, we need to decide what’s going
To happen if they go to the right. So I’ll start by kind of doing the left path. And let me just put a print statement here. So I don’t get an error. Um, you’ll notice that if you don’t have something indented after it’s expecting something to be indented, it will like
Yell at you and be angry. So you can just put an empty statement, like print and that will kind of fix it. Okay. So now what I’m going to do is I’m going to ask them another question. I mean, to say answer, and you can name these variables, whatever you
Want. Maybe it would make more sense to name them like Q2 or something. Whatever I’ll say, answer is equal to input. And I’ll say, um, okay, like you come to a river and you can walk around it or swim across. And I’ll say, type walk to walk around and swim, to swim across
And make sure that when you guys do this, you’re kind of like, uh, you know, telling the user what they need to type in, because sometimes it’s not intuitive on what they should be typing. And so I always try to give them the option, like tell them explicitly, like what I’m
Expecting them to type. So they don’t give me an invalid option. Uh, like not intentionally, you know? So now I’m going to check inside of here. If the answer is equal to swim, LF, the answer is equal to walk. And then else I will print not about option use.
Right. So we’ll do that. Okay. So now I need two things to happen here. So print and print. Okay. So I’m going to pause for a second. Hopefully you’re getting the idea of what’s going on here. Right? If they go left, I asked them a different question.
And then I check inside of this if statement, what the answer for that next question. And then I do something else. Whereas if they go right, I’m going to ask them a different question. And so it’s cool because there’s like all of these different paths that people can explore.
And like, if they only go left at the beginning, they’re only exploring like half of the potential paths. And then as soon as they go, right, there’s all new, different options. Now you could have the same options for different, um, things they type, right. If they decide to
Go left or right. You could in theory, ask them the same question if they go left or if they go right. But I like to do it differently. I think that’s more fun. So let’s just kind of continue on this path here. We’ll say, if the answer is
Equal to swim, then I’ll print. Um, you swam across and were eaten by an alligator. Is that how you spell alligator? Maybe you guys can tell my spelling is not the best. Okay. Eaten, eaten. There you go by an alligator. Nice. Now, if they decide to walk across, I’ll say
You walked for many miles, ran out of water and you lost the game. Okay. So both of these options here were inbound. So if they decide to go left, it doesn’t matter what they chose. They were just going to lose. And so instead they have to go rep. And so
We’ve kind of ended the path now on the left. But if we wanted to maybe swim was like the correct answer, quote, unquote, we can add another path here and we don’t have to have them lose on one of these options. I could add another path for walk to,
Right? Like hopefully you get in the idea. You can just chain these kind of if statements in as far as you want. So now let’s do something for going, right. And actually, before we do that, let’s, let’s test this out and let’s make sure you guys understand what’s going on here.
Okay. So type your name. I’m going to say, Tim says welcome Tim to this adventure. You’re on a dirt road in, is coming to an end and you can go left or right. Which way would you like to go? Let’s go left. When I go left, it says you come to river,
You can walk around it or swim across type walk to walk around and swim, to swim across. You’re gonna type swim. So as you swam across and were eaten by an alligator, and then there you go, boom, you lose. Right. Okay. So now let’s go and do something for, right.
So for right, I’m going to say, answer is equal to input. Um, I’m going to say you come to a, um, bridge. It looks wobbly. Do you want to cross it or head back, push them up. And then the options I’ll put here, I’m just going to put them in brackets.
I’ll say cross slash back to kind of really indicate, Hey, that’s the two things that you’re supposed to be typing cross or back. And then here, I’m going to just copy this if else structure, just so I can fill it in. I’m going to say if the answer is equal to back, if
The answer is equal to cross and then I’ll continue. So now I’m going to say, if answer equals back, uh, you go back to the, um, I don’t know, like main road, whatever. We can make this, whatever you want. Now you can decide to drive forward. I
Don’t know, drive to the left or go to the writer. You know what we can make going back. Just, just be the wrong option. We’ll just say you go back and lose. I don’t think you guys need me to, uh, to give too much detail because I’m having trouble
Coming up with this. Okay. So we’re going to say the crossing is the correct option. So if they decide to cross, then what we’re going to do here is now we’re going to ask them another question. We’re going to say, answer is equal to input. We’re going to
Say you cross the bridge and meet a stranger. Do you talk to them? And we’ll say yes. Comma, no question. Okay. And then same thing here. We can say, if answer is equal to yes. Uh, L if answer is equal, oops is equal to no. And then else will say
Not about option. You lose. So let me copy that. Okay. Not about option you lose. And then here again, we can decide what we want. So we’ll say print, maybe yes. Is like the correct answer. And it ends the game. We’d say, um, you talk to the stranger and they give you gold,
Whatever you win, exclamation point. Uh, otherwise, no, we can say print. Um, you ignore the stranger. If I could spell stranger correctly and they are offended and you lose. Okay. So again, I’m just like randomly coming up with this stuff. I’m sure you guys are laughing at the, the options that I’m going
With here, but I’m just trying to show you the structure of this program and kind of how, like the nesting works, that you can make this as advanced as you want. So now we’ve kind of implemented something for the right. So it asks you a question. Uh, obviously you
Lose. If you go back, uh, if you go to decide to cross, then you’re asked another question. You cross the bridge, meet a stranger. Do you talk to them? If the answer is, yes, you lose. Are you in? If the answer is no, what you lose? If you answer
Something, that’s not one of those then, uh, what do you call it? Uh, you lose. And then of course, if you want it to keep going from here, rather telling them they lose or they win, you would just ask them another question. And you would keep doing this and keep nesting this
If and else, and you can make multiple options to you. Don’t have to just do two options. You can make it so they could give you three options. You can make it so that you store one of their options in a variable like Nate, right? And then you use
That variable later on, like maybe they picked up a, I dunno, like a weapon or something really early. And if the weapon they chose really early is not correct. When they go down a certain path, then maybe they lose. Whereas if it was correct, then maybe they can continue on
Or something like that. And so last, I’m going to say print, thank you for trying comma. And then this is going to be their name. Okay. So let’s run this and I’ll just go through a few of the paths, but that’s pretty much gonna wrap up this game. This there’s not really much
More to show you. Uh, this is just a cool one. And I always find this fun. And obviously you guys can come up with better stories than I can. So type your name. Let’s say Tim, welcome Tim. This adventure you’re on a dirt road is coming
To an end. You can go left or right. I’m going to go, right? Okay. You come to a bridge, it looks wobbly. Do you want to cross her head back? I’m going to cross you cross the bridge and meet a stranger. Do you talk to them? No. It says you ignore
The stranger in their, and you lose. Thank you for trying to him right. There you go. And we can try this again. Type your name, Tim. Uh, you’re on dirt road. Let’s go left, right? You come to river, let’s walk. And it says, you walk for many miles
Around a water and he lost the game. I’m not going to go through all the options. I think you guys get the idea. Now that is the choose your own adventure game. Again, this code will be linked in the description if you want to download it, but this is
Kind of the template. Use the, if Elif and L structure and, you know, make this as advanced and complex as you want. Now let’s move on to the last project, which is the password manager. All right. So now moving on to the last project, which is a password manager.
Now, the point of this program is to kind of organize and store your passwords. So we’re going to store all of the passwords along with the username of the account they’re associated with any text file, but we are not going to store the passwords in plain text. We’re going to
Encrypt the passwords. Now, even though we’re encrypting these passwords, which means they’re going to need a kind of password to be able to decrypt them. So like, this is like a master password for all of the passwords. This is not a secure way of storing your passwords.
Do not rely on this for anything other than like a fun Python project. And I personally would not recommend storing at least any of your very sensitive passwords, uh, in this method. It’s just like a cool thing. And I wanted to show you how to do it. And it’s kind of a more
Advanced project out of the five that we’ve done. So the first thing I’m going to do here is I’m going to gonna write the code. That’s allowing us to actually ask the user whether they want to list out their passwords or whether they want to add a new one. And we’re
Going to store all of these in a text file. So I’ll do this project first without encrypting any of the passwords and then we’ll go in and encrypt them. So the first thing that we need to do is ask the user for like a master password. So we’re going
To say a PWD is equal to input, and we’ll say, what is the master password question mark. Now, we’re not actually going to validate this password is equal to something. We’re going to use this password to encrypt our, uh, our passwords. So if they type in the wrong password here,
It’s still going to work. Like the program will operate, but it won’t show them the correct password. And you’ll see how that means. When we kind of get later into the, uh, into the video, uh, regardless what I’m going to do now is ask them what mode they want to go in. So
Whether they want to add a new password or whether they want to view their passwords. So I’m going to say, um, mode is equal to input and we’ll say, would you like to add a new password or view existing ones? Question mark. And then the, uh, two inputs all allow will be, I
Guess, view and add, okay. So that’s what I’m expecting them to type in. Now, what I’m going to say is if mode is equal to view, we will do something. Uh, otherwise L if mode is, is equal to what I say, add, we will do something else. Otherwise Ellis
Will say, print in valid mode, and I’m going to take all of this. I’m going to put this inside of a wallet. So I’m going to say while true, cause will allow them to like add a password, then view them and like so on and so forth. And so in this LCL
To say, invalid mode, and then I’ll say continue, and what this will do will bring them to the top of the wallet. And then I’m also going to add something here that says, uh, caress cue to quit. And then I’m going to convert all of this to dot
Lower. And then I’m going to check at the very top here. I’m going to say, if mode equals, equals Q, then break the wallet. Okay, sweet. And then we could make this an Elif, but we don’t have to make an LF since we have a break here. If this is true,
It just won’t even bother checking these so up to you, but I’m not going to add the, uh, the LF. Okay. So now that we have this, what I’m going to do is show you something called a function. So I’m going to create two functions here. I’m going to
Say, define a view, and I’m going to say pass, and then I’m gonna say, define, and this is going to be app. Okay. So what the function is, is an executable reusable block of code. So the way you call a function is you write the name of it, which is this, okay?
And then two parentheses. So the basic syntax is you write Def to define a new function, space, name of the function, open and closing parentheses, and then any parameters that you want inside of here, I’m not going to really talk about what that is because I’m not trying to teach
Functions here. I’m just trying to show you how we can kind of split our code into different sections. And any ways, the way you call a function is by its name and then the opening closing parentheses. So if I put, say like print Tim inside of here, then I could call this
Function a bunch of times. And every single time I called this function, it would do whatever’s inside of here, which would print Tim. So if I had, you know, print him twice, every single time I call the function, it’s going to print out Tim, two times. Whatever’s indented
Inside of here. It just happens when you call the function pretty straightforward. But the point of me creating these two functions is that rather than writing all of the code related to the view mode and the ad mode in the wild loop, I’m going to put them in this function. So
It’s a little bit more organized and easier for me to kind of separate my program. So I’m just going to have pass inside of here right now. Now passes a keyword that literally does nothing. It is just there to make it so you don’t get any like indentation errors because you
Need to have something indented after the colon. And so for now, we’re just going to write pass, and you can see we’ve done that here too. So now, instead of just using pass, I’m going to call the view function. I’m going to call the add function. So now, depending on what mode
You select, it’s going to call these two functions, which will then perform the operations for that mode. And just a cleaner way to write the code. It makes it a little bit more organized. Okay. So let’s start with the, uh, the add function. What I want to do is create a new file.
If the file storing our password is doesn’t already exist and add the password into it. So the first thing I need to do is get the user account or whatever the username, and then the password. And then I want to add it into the file. So I’m going to say,
Uh, I guess name is equal to input and we’ll say account name like that. And then we’ll say PWD, which stands for password is equal to, and actually, sorry, this should just say password because we already have PWD up here. And in fact, let’s call this master under square
PWD, and then we can call this PWD. So PWD is equal to input and we’ll say password, colon like that. So now they’re inputting their account name and their password. Now, what I want to do is open a file or create a file if it doesn’t already exist and add
This password. So I’ll explain what this is doing in a second, but I’m going to say with open the name of my file, which in this case is going to be, uh, passwords dot TXT. We’re going to just use a text file for now, and we’re going to say comma,
And then we need to define the mode to open this file with now, the mode we’re going to use is a, which stands for a pen. We’re going to say as F and now explain what I just did. So when you use this width thing right here, this allows you to then do
Some things indented after it. And the point of this width, when you’re opening a file specifically, is that as soon as you are done doing all of the operations with the file, since we use this width, it will automatically close the file for us. So you can open a file like
This. You can say file equals open, and there you go. Now you have fun. But the thing is, if you do this, you need to make sure you manually close the file after you open it. Because if you don’t do that, your Python process will still be kind of
Like holding on to and using this file. And it’s going to cause problems. If you try to open this file somewhere else. And so it’s just better and safer to kind of use this with keyword, because now you don’t have to manually close it. It will automatically close the file for
You. So when it was, I’m going to say with open passwords are TXT in a mode now, so this is the name of the file. The next thing is the mode open the file. And now there’s a bunch of different modes. The main ones are w R an a now w means, right?
And what this will do is create a new file or override this file. If it already exists, very important. You understand this. If passwords dot TXT already exists and you open and w mode, it will clear that file and make an new one. So only use w mode.
If you want to always override a file that potentially already exists, okay, then there’s our mode. This is just simply read mode. You can’t write anything into the file. If you open it and read mode, all you can do is just read the file. That’s our mode. And obviously this is not
Going to destroy a file if it already exists. In fact, there’ll be a problem. If you try to open the file and it doesn’t exist in Arma, then you have a mode. This is a pen boat. This is probably the most flexible mode. What this allows you to do is
Add something to the end of an existing file and create a new file. If that file does not exist. So if passwords are TXT does not exist, a new file will be created called passwords out TXT. And then we can write to the file. If passwords are TXT
Already exists, we are able to write to the file and read the file from the very end. Uh, so sorry, we can write to the file from the very end, and we can just read the entire file when we open it in a mode. And so for adding something, we’re an open
In a mode, because if it exists, we append to the end. If it doesn’t, we create it. Awesome. So now what we’re going to do, let’s say after dot, right, that’s the name of our file? Cause we said, as F in, then we are going to write in the name,
Plus the pipe plus PWD. So what this is going to do is take the name. It’s going to separate, uh, the password with the pipe operator, and then it’s going to put the password and then we will have user and password inside of the font. So let’s actually try this out. Let me
Run this. You can see, it says, what is a master password? I just type whatever for now, just type hello. And would you like to add a new password or view existing ones view, come, add press Q to quit. Okay. I’m going to type, add, and then it says account name.
Let’s just go Tim password. Let’s go is underscore. Great. Okay. So now I’m just going to quit. Notice this password is that TXT file has been created. If I open it, I now have Tim and is great. And if I were to do this again, it would add the
Next line in. So actually let me rerun this. Let me say, add account name. Uh, Joe password is Billy, and then notice it gets added in here. The thing is though it got added on the same line and I don’t want this to be added in the same line. And so
What I’m going to do is I’m going to quit here and I’m going to make it so that I go to the next line. After I add each password in the way I do that is I add, what’s known as a line break. I think this is actually called a carriage return, maybe
A line break at the end of the line. So every single time I add a line, I tack on this little invisible character backslash in this won’t actually appear on the line. You won’t see this on the line, uh, but we will add that on. And what that tells the text
Editor to do is to go to the next line. So now the next time we write something in, it will be on the next line. So if I look at this, um, and we run this now, add Tim EI and five, four, three, two. And now if you
Look here, it goes to the next line. Okay. So hopefully that makes sense. But a, there you go. I’m just going to delete everything in that file. I’m going to quit this. And now we are able to add, uh, passwords and usernames in to the file.
What I’m going to do now is make it so that we can view all of the passwords. So to view all of the passwords, I need to, again, open this file. So I’m going to copy this. I’m going to say with open, and then this is going to
Be pastors dot TXT a as F I’m going to change this from a to B R because I don’t want to potentially create a new file or anything like that. I just want to read the existing file. And then what I’m going to do is I’m going to loop through the lines
Of the file and just print them out. So I’m going to say for line in F I’m going to say.read and actually read lines is what I want to do. Now, what read lines is going to do is just exactly what it says. It’s going to take the file.
Sorry. There should be F it’s going to read all the lines for it. And then what I can do is use a for-loop to get all of the lines of the file. So let’s just look at this. I’m going to say print line and let’s just see
What happens. Now. If we go to view human and then I’ll kind of walk through this more, so let’s run a master password. Doesn’t matter what say view and then, oh, there’s something in the file. So I didn’t chosen here. Okay. So let’s go add a account name. Let’s go Tim password
Test. And now let’s say view, and then notice it shows us Tim and test, but it’s printing a new line after it shows us this account name and this password. And so I’m going to show you how we can kind of fix this now. So the thing is, remember how I
Told you, we’re adding this kind of invisible backslash at the carriage return. Now, when we read the file, we actually read in that character turn. And so we need to strip this carriage return from our line. And the way we do that is we use this thing called our strip. Now,
What our strip will do is it will strip off the carriage return from our line. So that’s all you have to know, just our strip. That’s what it will do. There’s also something called strip and strip. We’ll strip off the carriage return as well. But our strip is like more
Specifically exactly for this. So what I’m going to do now is run the file or run the program. Master password. Doesn’t matter, I’m going to say view. And now notice that it’s not printing that new line after we print this line because we stripped off the carriage check. Great.
So now the thing is though I’m printing Tim pipe test. I kind of want to figure out or separate the username from the password. So how are we going to do that? Well, I’m going to say that my data is equal to line, got our strip, and then I’m
Actually going to split this data. So I’m going to say my user and pass is equal to, and sorry, this should be past w is equal to data dot split at, and this is going to be a pipe operator. Now this might seem really confusing. Uh, cause again, this is a beginner
Project. I know a lot of you guys haven’t seen the syntax before. What DOT’s split will do is it will take a string. It will look for this character right here, and it will split this string into a bunch of different items. Uh, every single time one of these characters is found.
So if you had like, hello pipe, Tim pipe, yes. Pipe to whatever, what would happen? Is this a data dot split would actually return to you the following. We would turn to a list that says, hello, Tim. Yes. And two. So remove all of these five characters and it would give you
All of the unique strings that are between these pipe characters in a list format. And so to access these different elements, you would use index zero one, two, three, so on and so forth. Now the thing is, we know we’re only ever going to have one pipe operator, right?
Unless the, uh, the password or the username contains a pipe operator. We’re just going to assume that it doesn’t contain a pipe operator just to make our life a little bit easier. If it did contain a pipe operator, there’d be some more steps we have to do. I’m not going to do
Them for right now. Anyways, we know we’re only going to have one pipe operator, which means the list that’s going to be returned to us. We’ll only have two elements in it. In fact, it will always have two elements in it. So what that means is that we can actually just grab both
Of those two elements by saying user comma pass. W so when you do something like user comma pass, w this assigns the first element in the list of user and the second element of the list to pass w and since we know our list always has two elements. That means we can do
This, right. Whereas if we had three elements, we would then have to add another variable, right? And then X would be assigned to X. Hopefully that makes sense. But that’s why we can do what we’re doing. And that’s kind of what the split operator does. So now what I’m
Going to do is I’m going to print out user colon, comma, user, and then password Cola, comma password, or pass w right. So now it will look a little bit nicer. So let’s go ahead and try this. I’m going to quit this program. I’m going to rerun it.
It’s going to say, what is the master password save test. I’m going to view. So now when I view, it says user Tim password test, and I think I should do like a separator between the user and the password. And so what I’m going to do is just add
A comma like that. Okay. So now, if we run this, let’s quit, let’s rerun master password test. Would you like to add a new password? I’m going to say view, it says user Tim comma password test, and there you go. And we could actually even split this up with a pipe operator. I
Think that will look cleaner. I’m not going to run it now, but we’ll do with the pipe. Sweet. So now we able to add passwords and we’re able to view them. But the problem is I can just look at this file and I can see what the password is. And well,
That’s not very good. We didn’t really want to do that. So we need to encrypt these passwords. All right. So how do we encrypt a password? Well, this is where it gets a little bit more difficult. That’s why I’ve kind of waited until this point to do the encryption. So you guys can
At least fall along with this part. So you had a right to files, read from files, all that kind of stuff there. Uh, so the way that you encrypt a password, we could write a manual encryption algorithm, but I’m not going to do that. That’s a bit beyond the scope of this
Tutorial is we use a module by someone, way smarter than all of us who knows how to do encryption. And the way that we use this module is we need to install it. So remember, at the beginning of the video, I was telling you, when we import a random that, Hey, we, there’s
Also other modules that are built by random people, right? Uh, that we can use. But the thing is we have to install them because they’re not by default with Python. So this is where a lot of you are probably going to have problems. If you haven’t done this before,
But open up your terminal or your command prompt, depending on your operating system, doesn’t matter which one. And just type PIP install, and then type Crip. Tography if I can spell it like that, PIP install, cryptography, just press enter and pray that this worksheet. Now, if this doesn’t work for
You, don’t worry. I’m going to show you how to fix this. Uh, but for some of you that should have worked, if that works for you, you’re good. You can kind of skip probably the next minute of this video, because I’m just gonna explain how to fix this.
If this doesn’t work for you, try the following command. Okay. PIP three, install, cryptography, PIP, three installed cryptography, press enter. See if that works. If that doesn’t work for you, try Python, hyphen M PIP, install cryptography. If that doesn’t work for you, try Python. Three hyphen M PIP, install
Cryptography. If none of those work for you, this means that PIP is not installed on your system. PIP is a actually a recursive acronym that stands for PIP installs packages. And well, what it does is installs packages for you. And by default, when you install Python, it’s not included in the installation.
I don’t know why they don’t just include it by default. You have to like check a little box to say, to install it. So you could just reinstall Python and check that box. It says, uh, fixed PIP, or you can follow the two videos that I have that are
Linked in the description. One for Mac, one for windows showing you how to fix this command. Now they’re not directly called like how to fix PIP. They show you how to install module called PI game. But when it comes to installing the pie game thing, just instead of doing PI game,
Do P uh, do cryptography, okay. She needs to install this cryptography cryptography module Surrey. Once you have that installed, we’re good to go. If you know what a Python interpreter is, and you have multiple on your system is going to be a bit more complicated. You need to make sure you’re
Using the right Python interpreter when you’re running your code, the one that you installed cryptography into, okay? So this one time I’m going to assume you’ve successfully installed cryptography. Uh, once you’ve done that, what you need to do is import it. So you’re going to say from, and then
Cryptography like that dot, and you’re going to type this thing called Fornet, uh, yeah. Fernet like that. And then you’re going to import from it. Now I’m looking at a cheat sheet I have, because this is not something I do very often. So I don’t have this memorized. Uh,
But this is a module that is going to allow you to encrypt texts. Essentially. Now the first thing that we need to do when we use this is we need to define, what’s known as a key. So essentially what this is going to do for you. And I’m not
Going to talk about it too much is it is going to, um, take a string of text and using a key, turn it into a completely kind of random string of texts that you can not give back to the original texts from without knowing the key. And this key is
Something that we’re going to combine with our master password. So imagine you have this key, okay. And then we have our password. So the key plus this password is what we’re going to use to encrypt our text. Now that means that if you type in the wrong password, when
You go to decrypt, the text what’s going to happen is you’re going to get something that makes no sense. It’s not going to be the original text because you need the key plus the password to be able to get back to the original text. So it’s kind of key plus password plus,
You know, text to encrypt. And then that equals like random texts. Okay. And then you have random text plus key plus password equals and then text to encrypt. Now this is obviously like a vast simplification of what’s going on here. Uh, but that’s kind of what we’re going to do with this
Module. So the master password in combination with the key that we’re going to store, we’ll be able to encrypt and decrypt our text. If you type in the wrong master password, you will have a wrong decrypted text. Okay. So what we need to do is write two functions, one function that can
Create a key for us. And one function that can store key. So I’m, or sorry, retrieve a key. So I’m going to say define right underscore key. I’m just copying this from my sheet over here, uh, that I have on my other monitor, I’m going to say key is
Equal to Fernet dot and then generate underscore key. And I’m going to say with open, and I’m going to say key dot key, the C key file, uh, and then WB the stands for right bytes mode as key underscore file. And then I’m going to say key underscore
File dot right. Key. Okay. So what this is doing is going to open a file. It’s going to create this file called KIDO key in WB mode, which means right in bites, you don’t really have to know what that means. It’s just a special file format. And then you press as key file
And, or sorry, as key file and then key file dot. Right? And you’re gonna write in this key that was generated by this thing called Fernet. Okay. That’s where we’re using up here. That we’ve imported. So you’re going to write, or sir, you’re going to run this function one time.
And when you run this functional one time, it’s going to create this key file for you. So let me show you when I just call right key here. Uh, after I input the master password, it will then create this. So let’s run this and we’ll just type some random
Thing. And then notice here we get this key file. Okay. And inside of here, you have this key, boom, good. Now remove the call, the right key. You can keep this function and if you want, you don’t need it any more, cause you already have the key. Uh, and so what I’m going
To do is I’m going to comment to them. So to do a multiline comments in Python, use three quotation marks, single or double, just make sure that the same on both side, uh, you do three at the start of the comment three at the end. And so now I’ve commented out this
Function. Make sure I don’t use it again because if I use it again, it’s going to be a problem. Okay. Now that we’ve done that we need a function to load this key. So in a similar way, actually, I’m just going to copy this. I’m going to change this now to be
Load key like that. And actually I probably shouldn’t have copied that. I’m just going to say return open, and then this is going to be key dot key and then.read. And the mode is going to be R B mode. Now the thing is, I need to take this here. I
Need to say file is equal to open I’m then going to say file.read. I’m going to store this in a key and then I’m going to say file dot close. Just to remind you that you got to close your file every time you open it. Okay. So I’m opening the
File in right or sorry, read slash bytes mode. So it’s reading bytes. I’m then going to read the file I’m then closing the file and then I’m returning the key again. You don’t really have to understand exactly how this is working. This is just part of the decryption stuff.
Okay. So now we have the key. So now that we have the key, what we’re going to do at the top of our program here is we’re going to load it. We’re going to say key is equal to load underscore key, which means this function needs to go above where I’m
Calling. So this is another interesting thing. Let me copy this right. Key as well, and put up here whenever you want to use a function, it needs to be defined before you use it. So I couldn’t have this function to find below this line. If I did that, that would
Mean that, uh, I wouldn’t be able to use this function because it wasn’t yet created when I tried to use it. So I got to create a first, then I can use it obviously. Okay. So now that we have that, what I’m going to say is, uh, fir is
Equal to Fernet. I’m going to pass key. Now this is just initializing this kind of encryption module. So you’re writing Fernet. You’re going to pass it the key. Okay. So actually I’m realizing I made a mistake here. I just got to take this stuff and I got to put this
Below the master passwords. I’m going to say a master password. Then Keke was low key for equals Fernet key, but then I’m going to change. My key to be key is equal to load key. Plus the master password two bytes. Now you probably don’t know what
This means. A bites is kind of a different way of storing information. You’ve probably heard of bits and bites before, not the snack, but like in terms of, uh, in terms of computing, right? You have bit and then you have bites and what, regardless we have our key and bites.
And so we need to convert our master password into bites so that, uh, this works. So we can add this together. Now, just like when you add two strings together, that’s exactly what’s happening here. We’re taking the key to which is in this file. And we’re just adding this
Master password in its bytes format to this key and then using that as the actual key. Okay. Hopefully that’s clear. That’s like a lot of the hard stuff now, encrypting stuff is really easy. So what I’m going to do now is when I go ahead and write my password, I’m going to
First convert this password into it’s encrypted version. So I’m going to say a for dot and then encrypt. And I’m just going to surround my password with that. But first I need to encode my password. Now, the reason I need to encode this is because in coding my password, we’ll
Convert this into bites. And actually I’m realizing here that this is going to be better. I’m going to say master password.in code rather than dot bytes. Again, all code does is it takes your string, turns it into bites. And so same thing here. I’m taking my password, I’m turning it into bites with
Dotting code and then I’m encrypting it. And I’m going to store that, uh, beside the name. And I also realize that now I need to convert this to a string. So I’m going to say string for dot encrypt, PWD dot, and code. And this will now encrypt and Incode our password. Okay? So
Now when we store these passwords, they should be stored in an encrypted format. So now the thing is we need to decrypt them when we show them. So to do that is going to be literally the exact same thing we just had here. So I’m going to copy this
Except instead of encrypt, it’s going to be decrypt. Okay. So we’re gonna say decrypt like that. And then instead of PWD, this is going to be a pass. W okay. So I’m hoping this is going to work. I have a feeling it’s not, I think I made a similar mistake here, but we’ll,
We’ll worry about that when we get to it. Okay. So now we should hopefully be storing encrypted information and reading non-encrypted information. Let me go and passwords and let me delete this because that is non-encrypted. And so that’s going to give us a problem right now and let’s go
Here and let me rerun this out. Okay. What is the master password? We now need to pick the master password that we want to use to encrypt our data. So I’m just going to make mine, Tim. Maker’s whatever you want. Would you like to add a new password? Yes. Want to add
Account name? We’re going to say maybe just like Facebook password. We’ll say Tim is great. Okay. Would you like to add new password or view an existing one? I’m going to say view and then we get a promises in valid token. Okay. So let me have a look here and see what’s wrong.
But if we go to password dot TXT, you can see that we are storing this in the file, and now I’ve actually already determined what’s wrong, but uh, let me just collect my thoughts and I’ll be right back. So I’ve realized the problem here. And it is that we are writing in
This B uh, what is it? I guess this is a quotation mark, and then another quotation mark here. And we can’t be doing that. So I’m actually going to clear this file. So the thing here in Python, and this is, I guess I can teach you about
Bites. Now, when you write a B, and then you have something after this, like I say, B and then, hello, this is a byte string. This is different than the string. Hello? When you have this little be before this means bites. So the thing is, we were
Writing in this little B, and we don’t want to do that because when we do that, that means when we tried to Crip, this it’s all wrong because we have this be in this quotation mark. And while just incorrect, we can’t be writing that into the file.
And so what I would do before, as you saw, I had a string surrounding this in our ad, fuck, we can’t have that. Instead of having a string, we need to decode this. So I forgot that we have this thing called the code. It’s the opposite of Incode. It’s going to take a
Bytes string and decode it to a regular strip. So now if we decode this all should be good. And same thing here. I F I had a, what do you call it? String like that. And that’s no good. I couldn’t do that instead. I just have to have for dot decrypt and
Then pass w dot and coats. So I’m going to take the string in, because I’m writing in a string, that’s not bites it just a string. And then what I’m going to do is convert that string into bites and then decode that bite string. And then that
Should work. So now let’s see if this works, I’m going to rerun the program. Paul, apologize about that mistake. I’m going to say, what does a master password we’re going to go, Tim, would you like to add, I’m going to say, add account name. Let’s just go Joe password one, two,
Three, four, five, six, seven. Okay. Now I’m going to say view. When I say view, it gives me a user Joe password B and then one, two, three, four, five, six, seven. So it’s showing me this bytes thing. If I want to remove this bites thing, I need to decode this. So
I’m going to decode like that. And now if I quit here and I rerun and I type in the master password, which is Tim and I press viewer type view, a non-type object has no attribute decode. Um, Hmm. Okay. What is the problem here? I was printing out this. Oh, sorry, guys. I
Added the dot D code at the end of the print statement. Not at the end of this first thing. So I had it like, after this bracket, it needs to be after this second closing bracket. So let me rerun this. Let me type in Tim, let me type in view. And
Now notice it gives me the correct password. One, two, three, four, five, six, seven. However, if I go to passwords dot TXT, you can’t see the correct faster, right? It’s soaring this like random string of jibberish that really like means absolutely nothing. And so if I actually quit this, let me
Just clear the screen and rerun. Uh, let’s go to password manager. Let’s go to run. And I type in the incorrect password. I’ll just type Tim too. And I type view notice it still gives me the correct password. Okay. It’s interesting that that’s giving me the correct password.
It shouldn’t be giving me the correct password. So let me look at this for a second. Okay. So I’m going to apologize here because I made a mistake. I thought that we were going to be able to use a master password in combination with our key and just do some kind of like
Hacking or manipulation to get this to work. Unfortunately, it looks like doing that’s way more complicated than I thought I just was looking on the internet right now. In fact, I’ll bring up the documentation that I found. Um, so we’re using this thing called Fernet, right? And there’s a way to use password
With Fernet, but I mean, you guys can kind of read this here. It’s a little bit complicated and I don’t really want to put you guys through all of this because this just beginner project. So I will leave a link to this documentation in the description. If you’d like to
Have a look at how to do this, but for now, I think I’m going to end the video here. So I’m just going to remove this master password feature. Obviously that’s pretty important, right? Like you would want to have a master password. So I really do apologize about that. But if you
Do this now and you just use the key as you used it before, um, everything will still work. So right now, if you run the program and I’ll show you and we don’t have a master pastas, would you like to add a password to view by type view? It gives me the correct
Passwords, right? Even though we use technically a different key that had the addition of our master password to kind of encrypt them previously, this still works. So anyways, that is where I’m going to leave it again. I’ll leave a link to that documentation that shows you how to implement the master password
In the description. Just too complicated for me to feel comfortable going through it in this kind of beginner tutorial. All right. So with that set, I hope you guys enjoyed these five mini Python projects. I hope they kind of gave you something to work on. Maybe taught you a
Little bit about Python and a minimum, you know, gave you a cool project that you can kind of extend and add on to. If you guys like these type of videos, please make, leave a, like, let me know what you want to see in the future, in the comments down
Below. And I will see you then YouTube video.
-
Sale!
Wireless WIFI Repeater Extender Amplifier Booster 300Mbps
$29.99$14.99 Add to cartWireless WIFI Repeater Extender Amplifier Booster 300Mbps
Categories: Electronics, Wi-Fi Router, Wireless Wi-Fi Extender Tags: 300Mbps, 802.11N, Amplifier, Booster, Extender, mobile wi-fi booster, Remote, WIFI, Wireless, Wireless WIFI, Wireless WIFI Repeater, Wireless WIFI Repeater Extender, Wireless WIFI Repeater Extender Amplifier, Wireless WIFI Repeater Extender Amplifier Booster, Wireless WIFI Repeater Extender Amplifier Booster 300Mbps$29.99$14.99 -
Sale!
Full RGB Light Design Gaming Headset Headphones with Mic
$24.99$14.99 Add to cartFull RGB Light Design Gaming Headset Headphones with Mic
Categories: Electronics, Gaming, Gaming Headsets Tags: Design, Full, Full RGB Light Design Gaming Headset, Full RGB Light Design Gaming Headset Headphones, Full RGB Light Design Gaming Headset Headphones with Mic, Gamer, Gaming, Gaming Headset Headphones, gaming headset wireless, Headphone, Headphones, Headset, Light, Mic, Package, RGB$24.99$14.99 -
Sale!
Wireless BlueTooth Multi-Device Keyboard Mouse Combo
$39.99$19.99 Add to cartWireless BlueTooth Multi-Device Keyboard Mouse Combo
Categories: Electronics, Gaming, Gaming Keyboards, Keyboard Mouse Combos Tags: Combo, Keyboard, keyboard mouse combos, Mouse, MultiDevice, Set, WireKeyboard Mouse Combo, Wireless, Wireless BlueTooth Keyboard Mouse Combo, Wireless BlueTooth Keyboard Mouse Combos, Wireless BlueTooth Multi-Device Keyboard Mouse Combo, Wireless BlueTooth Multi-Device Keyboard Mouse Combos$39.99$19.99 -
Sale!
High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
$199.99$139.99 Add to cartHigh Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
Categories: Gaming, Gaming Chairs Tags: Adjustable, Chair, computer chairs, Desk, Executive, Gaming, Girl, Headrest, High, High Back Leather Executive Adjustable Swivel Gaming Chair, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar, High Back Leather Executive Adjustable Swivel Gaming Chairs, Leather, Lumbar, Office, Racing, Swivel$199.99$139.99 -
Sale!
Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
$29.99$19.99 Select optionsProfessional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
SKU: N/A Categories: Electronics, Gaming, Gaming Headsets Tags: Cancelling, Gaming, Gaming Headphones with Noise Cancelling Microphone, gaming headset, Headphones, Headset, LED, Light, Mic, Microphone, Noise, Professional, Professional LED Light Wired Gaming Headphones, Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone, Wired, Wired Gaming Headphones, Wired Gaming Headphones with Noise Cancelling Microphone$29.99$19.99 -
Sale!
Gaming Desk with LED Lights USB Power Outlets and Charging Ports
$349.99$249.99 Select optionsGaming Desk with LED Lights USB Power Outlets and Charging Ports
SKU: N/A Categories: Computer Desk, Gaming, Gaming Desk Tags: and Charging Ports, Charging, Desk, Desks, Gaming, gaming desk with led lights, Gaming Desks with LED Lights, Home, LED, Lights, Monitor, Office, Outlets, Port, Power, Room, Stand, USB, USB Power Outlets, White, Workstation$349.99$249.99 -
Sale!
Wired Mixed Backlit Anti-Ghosting Gaming Keyboard
$99.99$79.99 Add to cartWired Mixed Backlit Anti-Ghosting Gaming Keyboard
Categories: Electronics, Gaming, Gaming Keyboards Tags: Antighosting, Backlit, Blue, brown, Gaming, Gaming Keyboard, gaming keyboards, gaming keyboards and mouse, Keyboard, Laptop, Switch, Wired, Wired Mixed Backlit Anti-Ghosting Gaming Keyboard, Wired Mixed Backlit Anti-Ghosting Gaming Keyboards, Wired Mixed Backlit Gaming Keyboard$99.99$79.99 -
Sale!
Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
$119.99$59.99 Add to cartWireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
Categories: Electronics, Gaming, Gaming Headsets Tags: 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, ANC, Audio, Bluetooth, Cancellation, Ear, Earphone, gaming headset, Headphones, Headset, Hi-Res Over the Ear Headphones Headset, HiRes, Noise, Wireless, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Headphones, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headsets$119.99$59.99 -
Sale!
Wired Sports Gaming Headset Earbuds with Microphone
$19.99$9.99 Select optionsWired Sports Gaming Headset Earbuds with Microphone
SKU: N/A Categories: Gaming, Gaming Headsets Tags: Accessories, Earbud, Earphone, Earphones, Gaming, gaming headset with microphone, Headphones, Headset, IOS, Microphone, Sports, Wired, Wired Sports Gaming Headset Earbuds, Wired Sports Gaming Headset Earbuds with Microphone, Wired Sports Headset Earbuds$19.99$9.99 -
Sale!
150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
$49.99$29.99 Add to cart150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
Categories: Charging Stations, Electronics Tags: 150W, 150W Charging Station, 150W Universal Multi USB Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Stations, 150W Universal Multi USB MAX Charging Station, 16 Port MAX Charging Station, 3.5A, Charger, Charging, Fast, laptop charging stations, Max, Multi, Port, Stand, Station, Universal, USB$49.99$29.99
Start a high paying tech career making $60k+/year with NO DEBT: https://coursecareers.com/a/techwithtim?course=software-dev-fundamentals
Thank you Tim❤
hi i have question, why does my result always print out incorrect whenever i give the correct answer to the questions?
how do you use the pipe symbole ? from your laptop ??????
sheldon?
As an ultra beginner 😂, i used .75x speed and was perfect. Great content ❤
When you type
for line in f:
Does python know that line means read a whole line as input? Or does it iterate over every single character in the file?
I want to create a program that reads an input file, but I want to iterate over every character in the file. Would I use the same for loop? Does the variable name (line) in this instance make a difference? Are there any special keywords after for?
Dont know why but as soon as i enter the lower "command", it doesnt matter if i insert lower or uppercase letters its allways wrong… Did everything exactly the same way and compared both codes in Virtual Studios 🥲😜
I am experienced rpa developer however I want to switch to python ..could u please help me to know projects that I could do to add in my resume…I want to do projects using python libraries like databricks, azure also would want to do some automation projects using python..Please suggest which video of urs should I start with..I have basic python knowledge have done coding ex . Connect to database or create basic crud application
Really useful stuff for a complete beginner. Easy examples with good explanations. I did notice a problem in the rock/paper/scissors solution. If both you and the computer pick the same value, you lose, the computer gets a point.
Python projects anyone tell sir
Bro you tech 90% of python In this single 1 hour video
I asked ChatGPT to create a choose-your-own-adventure game in Python four levels deep and within seconds I had following 100+ lines of code game. Very intuitive. It made use of functions per path instead of simple if-else statements. You can use chatGPT as a learning tool for Python and to explore different options:
#!/usr/bin/env python3
def get_input(options):
print("Options:")
for i, option in enumerate(options, 1):
print(f"{i}. {option}")
while True:
try:
choice = int(input("Enter the number of your choice: "))
if 1 <= choice <= len(options):
return choice
else:
print("Invalid choice. Please enter a number within the provided options.")
except ValueError:
print("Invalid input. Please enter a number.")
def start_game():
print("Welcome to the Mysterious Forest Adventure!")
print("You find yourself standing at the edge of a mysterious forest.")
print("You can see multiple paths leading into the dense woods.")
options = ["Take the left path", "Take the right path", "Go straight ahead"]
choice = get_input(options)
if choice == 1:
left_path()
elif choice == 2:
right_path()
elif choice == 3:
straight_ahead()
def left_path():
print("nYou decide to take the left path.")
print("As you walk deeper, you hear strange noises in the distance.")
print("Options:")
print("1. Investigate the noises.")
print("2. Continue walking without investigating.")
choice = get_input(["Investigate", "Continue walking"])
if choice == 1:
print("nYou discover a friendly group of forest creatures having a party!")
print("They invite you to join, and you have a great time.")
end_game("You made new friends!")
elif choice == 2:
print("nYou decide not to investigate and continue walking.")
print("The path leads you to a beautiful clearing with a waterfall.")
straight_ahead()
def right_path():
print("nYou choose the right path.")
print("The path becomes darker as you go further, and you notice mysterious symbols on the trees.")
print("Options:")
print("1. Follow the symbols.")
print("2. Ignore the symbols and continue.")
choice = get_input(["Follow the symbols", "Ignore the symbols"])
if choice == 1:
print("nYou follow the symbols and discover a hidden ancient temple.")
print("Inside, you find a treasure chest with valuable artifacts.")
end_game("You found the hidden treasure!")
elif choice == 2:
print("nYou ignore the symbols and continue walking.")
print("The path leads you to a magical grove with glowing flowers.")
straight_ahead()
def straight_ahead():
print("nYou walk straight ahead into the heart of the forest.")
print("The atmosphere becomes enchanted, and you feel a mystical energy.")
print("Options:")
print("1. Meditate in the magical grove.")
print("2. Keep walking deeper into the forest.")
choice = get_input(["Meditate", "Keep walking"])
if choice == 1:
print("nYou meditate in the magical grove and gain inner peace.")
end_game("You connected with the mystical energy of the forest.")
elif choice == 2:
print("nYou keep walking deeper into the forest.")
print("The path becomes less defined, and you start feeling lost.")
lost_in_the_forest()
def lost_in_the_forest():
print("nYou are lost in the depths of the forest.")
print("Options:")
print("1. Try to find your way back.")
print("2. Call for help.")
choice = get_input(["Try to find your way back", "Call for help"])
if choice == 1:
print("nYou navigate through the forest and eventually find your way back.")
end_game("You successfully found your way back!")
elif choice == 2:
print("nYou call for help, and a friendly forest guide appears.")
end_game("The guide leads you safely out of the forest.")
def end_game(message):
print("nCongratulations! " + message)
print("Thanks for playing the Mysterious Forest Adventure!")
# Start the game
start_game()
Nice tutorial Tim. For the Rock-Paper-Scissors game, it's not fair that the computer gets a point when equal pick! (you forgot to code for equal pick…)
When you changed the columns from 2 to 3, the values did not align on the left. How can that be corrected?
Great video!
Loved the video! One doubt – in project 3 how did you account for a tie? — eg: user & compute both picked rock.
Is the rock, paper, scissors game correct? doesnt the computer win, even though its a tie or am i confusing something?
cool video)
Finally, a teacher who gets it!!! Nice and quick. Easy. Real world examples.
Also, on the Rock Papers Scissors, I edited my program for when we picked the same and printed a "Draw".
Is the point of these projects to improve yourself ? But if someone wants to play to for real 😂 he can see all the answers if it’s inside the code so how do we switch to next faze where we make it a small py app outside the vsc i can’t figure out that thing
Your projects are amazing!
hey man, you made me get the interest of starting python. Big 👍🏻man.
Projects 1-4 are great, easy to understand, make Python fun and entertaining. First time in my life I actually finished a coding project!! Project 5 unfortunately was a bit too complicated to understand for a beginner I believe. 🙁 Nevertheless, still a fantastic video, thank you Tim!
Can someone please answer: For below code where-ever I write answer.lower() in second line and run the pgm it gives me incorrect even after typing correct answer.
answer = input("What is full form of CPU? ")
if answer == "Central processing unit":
print("Correct")
Else:
print("incorrect")
Great video! But also, if pip did not work for you, try writing pip3 instead, if not, then just do Tim's next steps XD
I got the MASTER QUESTION TO WORK
master_pwd = input("What is the master password? ").lower()
if master_pwd == "will":
Master_Password = True
then instead of while true say while Master_Password = True
then boom a working master password simple!!!!!
Okay but how do we make them into actual applications studio is making this a pain in the ass processing goated fr so simple
.lower() isn’t working for me. Even if I type the correct answer exactly as I had it in the code I still get the else print statement
please share more python projects
in 50:00 add 3 more elif statements for tie or the program will give score to computer which sucks
password manager part is just a huge waste of time, I wish you added some info about, you were not able to show how to do password manager with encryption, I was really enjoying this video for last 2 days but the last part was very disappointing, telling the audience that you are not going to finish it after almost 40 minutes of teaching is just not right, whatever good video anyway, but I wish you spend more time to how to make one pass manager before making the video. But whatever I just realize this is a 2 year old video…
thanks bro this was very helpful!
Hi, Tim! I think, for the rock, paper, scissors project, you forgot that a match could end with a draw. In your program there is just winning or losing, but no draw. And if it is a draw, none of the players should receive a point. Otherwise, great explanation of the projects! Personally, I totally understood what you have done there. 😁
do u guys know how can i share the quiz i coded with the vidéo to my friends ? 😁