When it comes to learning how to write computer programs, it can be hard to figure out where to start.

Well, look no further.

We just released a full course that teaches basic programming skills in both Python and C#. This course is for absolute beginners.

One of the best things about this course is that it is taught by Jabrils. He is one of the most entertaining tech YouTubers out there. He brings his strong technical skills and his fun style to this beginner's programming course.

one-jabrils--1-

Here are the topics you will learn about in this course:

  • What is an IDE?
  • Installing Your First IDE ‼ (Windows)
  • The Differences Between C# & Python
  • Code Your First Program!
  • What Are Data Types?
  • What is a Bool?
  • What is a String?
  • What is a Char?
  • What is a Float?
  • What is an Array?
  • What is a Variable?
  • What is an If Statement?
  • What is an Else Statement?
  • What is an Else If Statement?
  • What is a For Loop?
  • What is a While Loop?
  • What is a Method?
  • What is a Function?
  • How to Comment Your Code!
  • You can code anything you can imagine!

Watch the full course below or on the freeCodeCamp.org YouTube channel (5-hour watch).

Transcript

(autogenerated)

If you are familiar with Jabrils, you know that he is one of the most entertaining tech creators out there.

YouTube, the company, asked him to create a full programming course.

And we are proud to be able to release the entire course as one video on the freeCodeCamp channel.

Yo guys, all my life, I was told programming was hard.

It's only for the nerds.

It takes so much math, your grades aren't good enough.

But having programmed now for 13 years, I can confirm that all these assumptions are false.

And that is why when YouTube recently approached me with the opportunity to create an entry level programming course, I knew this was my opportunity to try and correct some misconceptions that I'm sure still preventing average people like you from diving into the amazing world of programming.

But first things first, we have to knock it off with this high wage medic field.

So you want to learn to code.

I mean, I don't blame you for insurance computer science as the second most valuable major to learn.

Now, of course, you could just go to your school and learn how to program or you could just learn how to program from a dunce like me that has no traditional schooling background.

Play.

Wait, hold on before you click off this video and sign up for a course at your local university.

Let me at least try and win your hearts with a quick story.

She's It all started when I was about nine years old, my friend invited me over to play this new game that I had never heard about.

Yeah, man.

It's crazy.

You get to play Donkey Kong if you want and fight against link Mario Pikachu.

And sure enough, he was talking about the original on the Nintendo 64.

And like, I had always played video games.

But there is something about this game that from that day on had me obsessed with video games.

I remember when my family moved from Virginia to California in 2000 the whole drive across the US I was designing my own Smash Bros levels using a little pain in Notepad and when Christmas came around, I asked my mother for a Nintendo 64 with Super Smash Brothers and I played that came for countless hours absolutely captivated with the concept of it all I conict internal mascots all together battling it out in a video game in three dimensions.

How is something like this even possible? This whole experience is what got me interested in wanting to understand more about how video games work, no, not to learn how to program because I was still at that age while still learning to read write in do basic maths.

Again, he got me interested in wanting to learn how games work.

And remember this because this will become important later.

It wasn't long after that until I came across a little website called newgrounds.com.

A place where people like me were making simple low budget games and interactive movies.

And I believe this truly to be the experience that planted the seed in my head that making video games like the ones that I love playing was actually possible for someone like me.

So a little later in life when I came across something called Game Maker, which advertises itself as you can start making games today, no code required.

And after weeks of begging my mother to buy it for me, she finally did.

And man, that was such a fun time in my life.

I had absolutely no idea what I was doing.

But just doing the best that I could create logical statements that will make a computer do what I want to do was enough to get me hooked.

Feeling that sensation of being truly tired for the first time.

Because I stayed up all night trying to understand how to create an inventory system is something I'll never forget.

From that day forward.

I continue to learn as much as I could, asking all for help who are willing to help me learning more and more not about programming, but about how games work.

Because you see, understanding how games work is what initially drew me to programming in the first place.

And without even knowing it.

That is what I would always fall back on when times got rough during my coding adventures.

And so moral of the story is, I know what it's like to have an extreme urge to learn this stuff while being not exactly sure where to start.

So I know exactly what you're missing and how to get you on this side of the fence.

And thankfully, I've learned how to do all this stuff without traditional schooling, which means you and I, we speak the same language.

Now if that story didn't went over your heart, you probably don't have one.

No, I'm just kidding.

I'm just kidding.

But I'm sure that this will this.

Here's my friends are glar zargar is a highly intelligent programmer that has no joke programmed, literal entire star systems solo using only a ti 80 calculator.

And when I told zargar I was gonna be making your programming course he Would not shut up about wanting to teach it for me.

Now zargar is a quintillion times smarter than I am.

But why do you not want zoglair? To teach this course? Well watch this zargar What is an array? Well, you see, we need a bit of a backstory, because traditionally memory can only store information at a 32 bit rate, which means recursion depth called the pull up on Moore's Law gained traction in 1996, we not only obtain more power and memories, okay, sorry, you've proved my point.

This audience didn't understand any of that PhD programming slowing me It's time to go.

And next time, remember, breathe.

Oh, man.

So welcome to my course.

In this series, you will leave with everything you need to start programming.

Yes, you've read the title, right? This is not clickbait.

In fact, by the end of this course, you will write your very first application utilizing everything that we learned.

But if you're to remember anything from this course, please let it be this.

Ask yourself, why are you here? What has drove you to want to learn everything you need to start programming? Again, for me, it was to understand how games work, Whatever your reason may be, I encourage you to write that reason in the comment section now.

And if at any point throughout this course or hell throughout anywhere in your programming adventures, things get tough, I want you to return to that comment and be reminded on the reason why you started.

Trust me, you got this, I promise, it's a lot easier than you think.

And I'm going to do the best I can on the communication side of things to make it even easier for you on this course.

I will see you on the next part.

Yes, it's so tight to see that you've clicked on this video and are interested in learning some programming principles.

Well, I'll tell you one thing, if you want to become a programmer, you aren't going to get very far without this thing.

This is called an ID.

There are many, many, many different types of IDs, some from large organizations that you've definitely heard of like Visual Studio from Microsoft Xcode from Apple and Android Studio from Google.

But there are also IDs from various other organizations as well.

Pie chart from JetBrains Eclipse from Eclipse sublime from a couple of dudes, Adam from GitHub, just to name a few.

And as you probably guessed, today's lesson is all about ID.

Hey, what does it mean? Duh, of course, how could I forget to cover that Id E stands for integrated development environment.

And just as the name suggests, it's a digital environment used to develop games, software, hardware, just about anything with code really, that offers integration or control over many aspects of development from debugging, which means adding removing or changing code that prevents your program from running as intended all the way to compiling, which roughly means taking your code and turning it into something that computers can understand.

Some ID support just a single language, for example, IDL, which is an ID that is bundled with the language Python when you download it, and it only supports Python, but IDs like Xcode from Apple supports a bunch of different languages like C, c++, Java, Python, the list goes on.

But as you see, my point here is that there are many different options when it comes to choosing your ID.

And honestly, it can be a bit intimidating.

But again, if you want to start programming you need in it later, when you get more experience under your belt, you can use Microsoft Word to write your programs, if you really wanted to the whole, I would not recommend this, no matter how much experience you get, you'll be wasting a ton of time.

And that is what it is a digital environment that is a various central parts of programming.

Where do you want to code, some games, software, hardware, you name it, and it is your best friend to help ensuring your success.

It's now time to install your first ID.

Are you ready? Let's do it.

And heads up.

There are many different IDs out there.

But instead of walking you through each and every ID, which would be a very boring lecture to sit through, you're instead going to get my bias and I'm going to show you how to install my two favorite IDs Microsoft Visual Studio, which should interest you if you want to get into Windows development or want to make games using a popular engine called unity.

And we'll also be installing Microsoft Visual Studio code, which should interest you if you're interested in more general programming or data science, as well as a slew of other tasks.

And yes, they both have Microsoft Visual Studio in their name.

And yes, they are two separate IDs.

Now, let's get started.

Alright, so the first thing you're going to want to do is open up your browser.

I'm going with Google Chrome as my browser.

You can choose whatever you want this far, it's not really important, but you want to search Visual Studio in the search bar and then click downloads, you'll see visual studio.microsoft.com Click downloads and it'll take you straight to The page that you want to be on.

So as you see, we have here a Visual Studio 2019, the Community Edition, let's hit free download there.

And then you also have your Visual Studio code, it will hold on one second, you'll see that it pops up down here, lets you know that it's downloading.

And then I'm gonna go back and then I'm gonna click Visual Studio code, free download, this is the second ID we need.

And it will pop up down here, let you know that it's downloading.

And just wait for that to download.

Alright, once those are done downloading, you can either click on them from here in Google Chrome, if that's what you're using, and they will start to install it.

But if you don't have Google Chrome, then you're going to want to find whatever your default Downloads folder is, in most cases, it should be downloads in Windows CE downloads.

But if not, you're going to want to find that so that you can install the IDs.

So first, let's install Visual Studio code.

I'm just gonna double click on this.

And you'll see that we get a window here that says Welcome to the windows studio, code wizard, setup wizard.

And this part's really easy.

It's just like any other installation you've ever done, you just hit next and you agree, read if you want.

Hit next.

And then here, you want to leave this at the default location, which is like see, somewhere somewhere Program Files, likely.

But because I already have this installed on my system, I'm going to install this in a very special location, so it doesn't mess with our presets.

So yeah, just leave that how that is hit next, and then just hit next.

And here, I would recommend that you check open with code and on both of them.

And also make sure that add the path is checked as well.

And what these to do here is allows you for like let's say you have some Python scripts, and instead of having to open up first Visual Studio code, and then hitting file and then open and searching for it, you can just go to like, let's say one of these are a Python script, you can just right click on it.

And then you'll have this available here where it's open with code.

So it will just open that file directly in Visual Studio code is very convenient.

You can also do that with directories in case you have a a file, I'm sorry, you have a folder with a lot of Python scripts, you can just right click somewhere in the folder, hit open with code.

Very, very useful, I would, I would definitely recommend checking both of these, and then just hit next.

Now I'm going to go back and remove these because again, I don't want to mess up my presets.

But this is how your years should look with of course, this the next destination being C C program files, whatever, whatever.

And then after that, just click install, install, and then you can see that it's going to install.

So I'm going to take couple seconds, I'm going to take terribly long, and bada boom, there you have it, Visual Studio code has officially been installed.

We're gonna hit finish and launch vinje Visual Studio code.

I'm going to bring this Oops, wrong window.

Going to bring Visual Studio code over here.

This is what it looks like.

Now before we get started, there's a couple of things that you want to do, you do definitely want to add Python right here.

So click Install.

In fact, I'm going to show you how to do it traditionally just search Python and then install just Python.

This allows you to use Python with Visual Studio code.

And there are a few options to do that.

But this one is straight from Microsoft.

So just install the top one that's just called Python.

And another extension that we're going to need is called code runner, just searched code runner, open the extensions and download the first one is going to allow us to run our Python scripts within Visual Studio code without having to leave the ID.

It's very nice.

Alright, and there you have it, Visual Studio code is installed.

If you want to do new file, just go to File, top new file and bada boom.

If you want to save an extension use simply save the file anywhere, we'll just do documents, for example, and just do like my, my file I don't know.and.pi will get you a Python script, hit save.

And now it's recognized as a Python script.

And if you get this pop up here that tells us that Python is installed.

Visual Studio code is often really good with letting you know like what you need and what you well not so much don't need but really Google with let me know what you need.

So let's hit download here is in a pop up window window, we're going to want to download python 3.7.

And then I'm just going to hit what run odds it's save open folder here.

And I'm just going to double click that to run it.

Next all you want to do is just hit Add Python 3.7 the path and then just click install now.

And it's just going to install now.

Give a little time and Python should be installed.

And just like that setup was successful.

So back in our Downloads folder.

I'm just going to double click that The Visual Studio installer.

And I'm not sure what you're seeing right now, but it's asking me to type in my password.

So I'm going to do that.

Let's see, hold on.

No, it's an older pin, sorry.

All right, sorry, one black there for a second.

And then we have Visual Studio installer, just hit Continue.

And it's going to start downloading and installing some stuff shouldn't take too long, then you should see something like this pop up.

And they're going to give you a few options, you can ignore most of them, maybe come back to him later when you get a bit more experience.

But all you really need is this one on here.

dotnet desktop development, because we're looking for is the console applications using C sharp, so just click that one.

And then you just click install, and see install on system drives recommended.

Again, I have this already installed.

So I'm going to place this in a very special location, but definitely placed this installed on your system drive where it's recommended.

So I'm gonna hit OK.

And you get this that pops up, thank you for installing, take a survey now.

And this will start installing, it's probably going to take a little while.

But once it's done, you won't have much to worry about.

All right, and once it's at 100%, give it a second.

It's kind of a start automatically, because we had that checked.

And bada boom, now you have welcome connect all your developer services, developer services.

Just hit not now maybe later, at some point to force you to make an account anyway.

So just for now, we'll do not now start Microsoft Visual Studio, preparing your first time use.

And here we are.

Now if you want to create a new project, you simply just hit that hit create a new project.

And then we'll ask you what type of projects you want to make.

We're just going to do a simple c console project and C sharp here, and then hit next.

And you can name it, let's just name it all just leave how it is concert project one is fine.

And create console app sorry.

I don't know how to read.

Give that a second, and bada bing, it'll start up and now you're officially in.

And that's pretty much all you have to do for C sharp.

So if you're on a program in C sharp and or Python, it's important to understand their syntax.

But first off what is syntax? Well, syntax in relation to programming, it's pretty much a set of rules that must be followed in order of operation that your code must abide by a process that must be respected if you want your program to run.

And so today, we're gonna look at the syntax for two different languages and see the differences between them, because I think it could be really helpful for you to see how they compare and contrast.

And plus, you'll pretty much learn two languages at once.

And so on the left is language C sharp using the IE Visual Studio, which should interest you if you don't do any windows development or want to make games using a popular game engine called unity.

And on the right is language Python three using the IEEE Visual Studio code, which should interest you if you want to get into general programming or data science.

Alright, so here I have two brand new console projects.

So the first thing we're looking at today is how both languages go about utilizing data types.

Now data types by themselves are useless, you have to assign a data type to a variable.

Now to get started in C sharp over on the left, I'm just going to get rid of these two lines because I no longer need them that comes stock with every new project.

And then we're going to use a Boolean as our example today.

Now a Boolean is a type of data that can only be one of two types.

It's either true, or its false.

So let's initialize a Boolean in C sharp.

Let's call it do it.

And then we're going to assign true to it.

So do it equals true.

Now this is all great and all do it is a Boolean that we assigned to be true.

However, C sharp will not recognize it as a Boolean unless you cast its data type.

And in C sharp, you simply cast the data type by going before the variable which again, a variable has to do it before it just type whatever the data type is.

So this is bool, which is short for Boolean bool do it equals true so your error goes away and everything checks out.

And this very syntax goes for every variable.

For example, if you want to initialize a string variable, you have to cast it.

So I'm gonna say this is a string.

I'm gonna call str short for string, and then I'm going to sign hello to it.

For example, you have to do this for every single variable.

However, there's a bit of a catch.

So I'm just getting rid of this line because I don't need anymore.

You only Have to initialize your variables on their first use.

So like, if I wanted to change the duvet Boolean variable, I just have to come down here.

And I need to do it equals false, for example, and that's because we're on this line right here.

The program knows what the data type for the do it variable is, he knows that it's a bool.

So I don't have to do it again.

In fact, if I try and do it again, you'll see that I get an error, this error is pretty much just telling me that like, I can't create the same variable twice, essentially.

So just remember, you only have to initialize on the first use.

And this convention is for every single data type.

So it's Boolean strings, that's integers as floats, every single one.

Now over in Python, things are a lot different.

So let's say we want to do the same example always want to initialize a boolean variable? Well, in Python, all you have to do is just write the name of a variable and then assign whatever value you want to it.

So in this case, we're gonna assign true to it.

And there we go, we just initialize a boolean variable.

That's right.

In Python, you don't have to cast your variables, you don't have to cast the data type of what you want your variable to be, like you do in C sharp.

And this benefit comes from the fact that Python is what's called an interpreted language.

And what that means is, all you have to do is create a variable and then assign some value to it.

And depending on what value you assign to your variable, Python will interpret what type of data type that variable should have.

And with this syntax, it enables a lot of flexibility with the Python language.

It's one of the reasons why so many people love Python, because it's kind of like a breath of fresh air, as far as computer languages are concerned.

And it's one of the reasons why a lot of developers that are into data science when I use Python, because as you can see, you can save a lot of time not having to type, you know that the data type over and over and over for your variables.

However, the flexibility doesn't stop there.

I'm going to simply print out What do it equals, like, so save it, hit the play button, and you'll see that do it equals true, obviously, is what you expected.

But check this out.

If we want to reassign it to be false.

For example, we just come down and say do it equals false, save, hit the play button, and we have a false value.

But this is where it gets really cool.

So currently, as you understand it, do it is a boolean variable.

But we can do do it equals 13,037, for example.

So first we assign true and then we change the mind sign to false and then we change the mind again, and assign it to 1337.

When I hit play, no errors, it just prints out that is 1337.

The last thing we assigned it to, which is crazy flexibility over in C sharp, we simply cannot do that if we want to change the do it to be a like an integer, for example, we're simply just going to get an error saying that, you know, you cannot convert an integer into a bool.

Once a variable has its data type, it cannot be changed.

And this is probably one of the biggest differences between C sharp and Python at the fact that how they go about casting their data types.

Next, I want to get into command terminations and the differences between C sharp and Python.

First things first, what is a command? Well, for example, this bit of code here is a command.

And what it's saying is take our dude variable and assign a false value to it.

Same with up here, take our dude variable, assign a true value to it, and also cast it as a Boolean.

These are examples of commands.

So on a very low level, the way a computer works is that it needs to know when these commands begin and in so it knows what it needs to process.

And so that is where a command termination comes into play.

We need something to be able to separate all these different commands.

And in C sharp, the command termination is a semi colon.

These semi colons right here is what you have to add to the end of every single command to be able to tell the computer that hey, this command is over, you can process this before you processed the next one.

I'm grossly simplifying it but that's how it works on the higher level.

And so with that in C sharp so long as you have a semi colon separating your previous command for your next one, you can place your commands anywhere you want.

For example, I can move this, this command right here to be right after the previous command.

No errors, no issues, I can put it back on the next line and hit Tab a bunch of times, no issues no errors.

You have a lot of flexibility using the semi colon as a command termination C sharp has a lot of flexibility in this regard using the semi colon as a command termination.

Now over in Python, they differ here a lot as well.

So you might look at C sharp and see okay, semi colon that makes sense as a command termination with Python.

What How do they do that? Well, the answer is quite simple, actually, instead of using semi colons, they just use a line break.

So if you want to separate two commands, you just put it on a new line.

Easy as that, in fact, to demonstrate, we can't do what we did over here in C sharp.

If we were to put these right next to each other, and then save it, you'll see that in the problems tab, it says that we have invalid syntax because you can't, it doesn't know what's going on here.

Why is there a value and a variable afternoon, it just doesn't understand how ever Python kind of thought of all the stops, you can simply just add a semi colon and Wallah, it will now act as a command termination.

In fact, just to prove that, it does what I say it does, I'm going to bring them all on the same line to command terminations.

And then I'm going to press play and show you that it runs it prints out 1337.

So yeah, in this regard, this makes Python really really flexible.

Because you can use semi colons if you want to.

However, you'll find that most developers don't, because it's often a lot faster to just use the new line command termination instead of the semi colons.

And Allow me to demonstrate that.

So I'm just going to restore both scripts to back how they were, this is a new line.

This is a new line.

This to do this.

Alright, so now they're back to their back restored.

So the reason why you can save a lot of time is because if you look at the two different scripts, they kind of both just use a new line termination anyway, even if you were to look at more complex C sharp scripts, oftentimes you'll find that over 90% of a C sharp script is going to use like a new line as a command termination anyway.

So you're actually saving a lot of time without having to type you know, semi colon, semi colon, semi colon, and you'll see that it turns red in this context, because it's letting you know that it's pretty much useless.

Like we know that you want to terminate this command by going to new line.

And then if we were to hit backspace to turns white, because like, okay, now it's in use, we understand what you're trying to do here.

But please know, this is a feature that comes with the Visual Studio Code ID.

So take the information as you want, but do know that most Python developers will probably look at you sideways if they see any semi colons in your in your code.

So yeah, there are a couple of syntax differences there.

Next, I want to go over how they differ in code blocking.

So first question, what is code blocking? Well, I'm gonna come over here in C sharp and give you a quick example.

First and foremost, the way that you indicate a block of code is to use these braces.

Anything that goes inside of these braces is a block of code.

So the general syntax, you don't have to follow this, but most developers will put a block of code, one line in the middle is all the code that will be ran within that block of code, and then a brace at the end.

And so here, we can like just move our do it equals false into here, for example.

And of course, get rid of this one because we don't need it.

And just like that, we have a block of code in C sharp, however, a block of code like this is pretty useless to add because it's going to be ran regardless.

However, what blocking off code allows you to do is you can add things like for example, an if statement.

So we can say if do it, then set duals equals false.

And this block of code will only run if do it equals true.

And I want to prove this to you.

So I'm going to come up here, and I'm going to write console, dot write line, this is going to print anything that we want to the console.

And I'm going to say checking.

And then I'm going to come down here and then do it again.

I'm gonna say console dot write, or wait, what is that? console, dot write line, there we go.

Um, okay, set to false.

Right.

And then at the end, we need a console dot read key.

This just makes sure that the terminal does not close when we hit the start button, which is up here and I'm going to press boom, terminals off screen on, bring it up, and there we go.

You see that it goes checking, and then it sets it to false.

But you are not convinced because we blocked out this code and it's still ran.

So I'm going to change do a T equals false and watch what happens when I hit the start button and bring the terminal over here.

It just says checking because, again, do it equals false And we said if do it, which is another way of saying if do it equals true, then run this block of code.

And at the fact that do it equals false, this block goat has never ran.

And that's code blocking, you'll find that code blocking is very important and very useful for all things programming.

But that's how you do it in C sharp.

Now over in Python, it's again, a lot different, I'm going to get rid of these two lines just to make it a lot less confusing.

And so everything under the condition and indented will be counted as that block of code.

Alright, and I'm going to run that, and you will see that we get checking set to false.

And then we also had an extra print down here, that our move next time, but that also prints out false as well.

And again, you're not convinced because this block of code is run anyway.

So we're going to set this value to be false.

And then I'm also going to remove this just so it's not confusing when it prints, and then save, hit play and only checking.

And so that is how you do code blocking in Python.

And so as you can see, code blocking is another syntax as C sharp and Python have a lot of differences between.

But it's very important to know how to code walk in both languages, because you'll be using it quite a lot for for loops for if statements for methods, functions, all types of stuff.

And the very last thing that I want to go over today is what's called variable scoping.

So what is variable scoping? Well, with the introduction to code blocking, that's this right here, a block of code.

Remember, this is a block of code as well, well, more right here, this is a block of code.

But with the introduction to these blocks of code, now you have to worry about the scope of your variables.

So let me give you a quick example.

So let's say inside of this block of code, here, we want to initialize a new variable.

Let's initialize just to do an integer, we'll call it a just for an example.

And then we'll assign a zero value to it right? Well, because we initialize this integer variable within this block of code, it cannot be used outside of this block of code.

And to demonstrate, I'm going to come down here, and I'm going to do outside of the block of code, console dot write line, oops, bright line.

A, for example.

And you can see what happens is it says that this variable does not exist.

What do you mean, it doesn't exist, so we initialize it here? Well, again, like I said, this variable, because we initialize it within this block of code cannot leave this block of code.

If we wanted to leave this block of code, we have to do it like this, we come out here, oops, we come out here and we initialize int a equals to say, five, for example.

And then inside of this block of code, we just change, we just reassign it back to zero.

So because it's it's initialized within this block of code, which is our main function, we can use it outside of this block of code.

And that is variable scoping.

In a nutshell, over in C sharp, this syntax is no different.

So if we were to come inside this block of code and initialize an A, assign a zero to that, and then come outside of this block of code and try and print that a variable, you'll see that when we save and hit the play button, that we get an error syntax error saying that this a the variable is not defined.

And again, if we want to get around this, we have to change the scope of a variable.

So come out to the regular indentation, and just do a equals five, for example.

And then when we get into this scope, we're simply just going to reassign it, change it to zero, and then we'll be able to print it and approve that I hit save, and then I hit play.

And there you go, checking five.

And again, just want to make sure I cover all bases.

The reason why this prints out checking five is because we said do it equals false.

And if do it is true, then this bytecode will be ran, but because do it as false as both code is not ran.

So it just skips this entire thing.

And it just prints out five, which is what we assigned a to.

And that's pretty much it.

That is everything that you need to notice our programming in regards to the syntax.

And so in conclusion, even though C sharp and Python have differences in their syntax, as you can see, the differences are small enough to be able to remember the important stuff, you have to cast data types in C sharp Python, you do not in C sharp, you must use semicolons to terminate commands.

Python uses new line breaks, and C sharp uses curly braces for co blocking while Python uses indentation.

Of course, there are more differences in their syntax.

But these are the major differences that often confuse the developers.

All right.

All right.

All right.

It's that time to code your first program.

Are you ready to do this Get set, let's go.

So we're going to make a simple MATLAB application.

In the console, because it's simple, doesn't require you to install a million things and is something you can actually show off to your friends and family.

Now, before we jump into this first things, first, the code to this project is in the description.

Also, I think it's important to let you know that this lesson is kind of acting as a placement test.

If you're just beginning to program, you might struggle with understanding what's going on in the code.

And if that is you, well, that's okay.

Because I structure this lesson to be just a little bit difficult to follow.

Once able to code a project like this by yourself, then, I don't think there's much this course can teach you at that point.

But I encourage you to watch the whole thing and follow along.

Anyway.

Again, the code is in the description.

So you can just refer to that and follow along with me.

Because if you do the following, you will get the greatest inspiration to become a programmer.

After you struggle, I encourage you to go through the rest of my course LinkedIn description, or just check out the lessons on the stuff that wasn't easy to follow.

I have over 20 videos teach you how to code and those videos go in depth about their respective topics.

Then, when you feel comfortable, come back to this lesson and see how will you do a second or third time coding your first project.

And trust me, when you ever look at how much you didn't understand in comparison to the next time you try and code your first project, you will not want to stop programming having program for 15 years, I can tell you that feeling pretty much summarizes programming very well, it can become quite addicting to chase but in addiction in the best way possible.

However, if this is your second or third or more times coding your first project, I encourage you to not copy the code verbatim.

But maybe create your own story or at if statements and functions this mad labs game who knows your experimentation could start a whole new programming trend.

Lastly, if you want to share your project with me, feel free to tweet it to me and I'd be happy to reply back to you.

But now with all that stuff out the way, let's get started on coding your first program.

And we're going to make his application in two different languages because I think it can be really helpful for you to see how they compare and contrast.

And plus, you'll pretty much learn two languages at once.

So on the left is the language C sharp using the ID Visual Studio, which should interest you if you want to do windows development, or if you want to make games using one of the most popular game engines called unity.

And on the right is the language Python three using the ID Visual Studio code which should interest you if you want to get into more general programming or data science.

Alright, let's actually begin writing our Mad Libs program.

Now before I write any project or program or prototype, what have you, I usually like to start what I like to call a skeleton and what a skeleton is, it's pretty much just like a step by step process in which you can expect to have to do in order to complete the actual project.

And because this is a smaller, simpler program, we can simply do this by writing out a few comments.

So first, I will comment out initialize variables, and it just stands for initialize is shorter cork at the right then after that simply gets input from user.

So we're gonna initialize the variables.

And then we're going to ask the user to fill out the data for those variables.

And then after that, we need to initialize whoops, and knit story.

And then after we initialize our story, then we simply just need to print our story.

And for parts, our program will be done.

Simple, easy and to the point.

And now let's just do that same thing in Python, do a comment, and then a net variables and then get oops get input from user.

And then after that, we're going to end our story.

And then after that, we need to print story.

Easy as that.

Next thing I'll do real quick is just beautify our script.

I'm just going to add spaces between all the comments, it just helps me read it and understand the different processes that need to take place.

Perfect.

Alright, moving on.

Now before we can do anything over here, C sharp on the left, we kind of need our story because everything depends on our story, really.

So I'm going to paste in a quote from the matrix.

I'm just gonna highlight all this real quick and hit Tab a couple times to beautify it, make it easier for me to read.

But you are welcome to make up your own story.

You're welcome to grab anything from the internet.

Whatever you want to use as your Mad Libs story is completely fine.

I even put the story in the description if you want to use it as well.

But there we have it.

This is the story they want to use for C sharp.

And now I'm going to do the same for Python.

just paste in that story string, same exact thing just in a Python format.

Next thing I'm going to do is simply just print out story.

And in C sharp, you're going to want to do console dot write line.

And then ad lib story, Mad Libs story, boom, semi colon, done.

And in Python, we're going to want to wait, I'm gonna change this to say Madlib story just so that it's the same mother story perfect.

And in Python, it's really simple.

You simply just type prints, and then Madlib story, boom.

So next what we want to do is get input from user.

But we can't really get any input from the user because we have no variables to pass to the user to collect data from.

And so what our next actual step is, we have to initialize our variable so that we can pass it to the user.

And to initialize our variables.

Well, we need to turn our Mad Libs story into a bunch of variables.

And we can do that quite simply, if you're at all familiar with the game, Mad Libs thing, you know, the whole fun of the game is that you have some story or some text or something like that.

And you replace all the verbs, the nouns, the adjectives, etc, with words that are similar context, hopefully, but not exactly.

And it makes for like, really funny, interesting stories.

And so what we want to do is want to scroll through our text and essentially replace verbs, nouns, adjectives, with variables, and the first one I'm going to do is the matrix, I'm just going to put curly braces around this, oh, yeah, I need to make this into an interpolated string.

I'm gonna do that for all of these strings.

And this needs to be a variable, which is one word, the matrix boom.

And so I'm simply going to come to a new variables, I'm going to initialize the string data type, and put the matrix in there.

And now the matrix is a variable that we can ask the user for, and they can change to whatever they want.

And I kind of did this ahead of time, I went through the text and picked a lotta verbs, nouns, adjectives that I thought would be interesting to change.

So I'm just gonna go through and do that, for example, system is another one, I'm going to change system to variables can add that to this list.

And I'm just going to do that for the entire text.

I'm going to skip it though, cuz it's not that fun to watch.

Alright, so I went through my story and replaced all of the interesting verbs, nouns, adjectives, etc, with variables so that we can pass that to the user, and they can put whatever words they want there.

But now I want to show you your first optimization trick.

If you look at this line here, the sentence as businessmen, teachers, lawyers, carpenters, these are all professions, that's what that's what they all have in common.

And at the fact that they go back to back to back, we can do is really cool trick.

Well, we will initialize a string array, and we'll call them profession.

And then back up to initialize equals new string array of how many are there 1234, a four.

And so now we can do this really cool trick where we come in here, and just make this an interpolated string.

And overload case that just for good practice, businessmen, and Oops, sorry, that's not what I want to do, I want to do profession, zero, because we're gonna do a for loop, which I'll get into in a second.

I'm gonna copy this, because I'm lazy.

And I'm going to paste this here, and increment it, and then we'll paste this here.

And then I'm going to increment it to two.

And then the final profession, increments this to three, already start on zero, simple into the point.

And so now what we can do is when we get input from user, since there are four professions, they're all back to back, we can simply just write a simple for loop and ask the user for four different different professions, one after another.

And I'll show you how to do that in a bit.

But there's also two additives down here that also do this with so I'm just going to initialize a new string array, call this additive AJ, DJ sharp additive equals new string array of two, there's only two in there.

And so here, turn this into an interpolated stream, is gonna be a D j, zero.

And I'm gonna copy this because I am lazy in this is the second adjective.

I'm just going to increment.

And there you have it, we now have our two string arrays.

And final note, if you look down here, you'll see a bunch of errors for unassigned local variables.

And that's only because we have not assigned these variables to anything yet.

I believe they're there no at the moment, which is Your program does not like but we will be assigning the variables when we get the input from user.

And over in Python on the right, it's a lot of the same.

First, let's turn all of our strings into interpolated strings.

And it's just like C sharp, except it's an F instead of $1 sign.

So I'm just gonna add an F to all the strings.

Perfect.

And let's pop out this variable right here, the matrix, or rather, let's turn this into a variable called the matrix.

And then let's initialize it up here and do the matrix equals empty string.

All right, and then let's do system next interpolated string system.

And then system like this paste equals empty string.

And I'm gonna go through and do this for all the interesting verbs, adjectives and nouns in this text.

Alright, so I pulled out all the interesting words and turn them into variables.

And now I'm going to show you how to do that optimization trick over in Python.

So again, we have these four professions, and we want to turn that into a string array.

And to do that in Python was going to do profession equals brackets, and therefore rooms are going to empty string, empty string, empty string, empty string for empty strings.

And there we have a, an array with four strings in it, that we can pass the user and then they can change the beer or whatever they want.

And it's the same as C sharp doesn't use interpolated string, professions zero, I'm lazy, I'm a copy this and paste it here, increment it, paste it here, incremented pasted here, increment it, oops, yeah, it is three.

And then we also want our adjective array, which is only two.

So I'm gonna do brackets, empty string, and then another empty string to empty strings.

And then that goes here, which is a edge, zero, I'm going to copy this because I'm lazy, and then paste it on dependent, and then increment that, and bada boom, now the scripts are in the same exact state.

For All right, the final stretch, let's get that input from the user.

So first of all, there are two functions that we need to familiarize herself with.

One we've already went over, and that is console dot write line.

This is where we're going to use to print something to the console.

And the second one is console dot read line.

This is where we're going to use Well, there's no input parameters.

But this is going to return to us a string that we can set our string variables to.

And this comes whatever the user types into the console presses enter.

That's what's going to be returned with console dot read line.

So for example, we can do the matrix equals console dot readline.

Easy as that.

So let's get started.

I kind of ahead of time crafted a little interesting story that the user can have with the terminal just to make sure I'm not Stumbling on this part.

But let's start off with console dot write line.

Let's just do like, welcome.

user, welcome user.

And then we can go down to another one, console dot write line.

And then let's say let's play, let's play a game of Mad Libs.

And then after that, we can get their name.

So we can say, let's do another console dot write line.

And then please share with me your name.

And then here is where the terminal is going to stop and allow them to put in some input.

so here we can do Neo, since that's the name of the character in the text, equals and we can do console dot read line.

And whatever they returned here is what the variable Neo is going to be set as.

And just in case you don't believe me, let's actually run this program and see that being printed on the screen.

First thing we need to do though, is with all these errors, it won't allow us to actually run the program.

So let's just comment out this and Tired thing, whoops, hold on a second, I need to do that and comment this out, come with that one all the way down the line.

So this doesn't get compiled.

And then let's replace this for now with, with Neil.

So whatever name that we pass to the terminal, it's just going to spit that right back at us.

And that's going to prove to you that we're able to set variables this way.

So I'm gonna come up here to the top and hit start.

And my window actually goes out of frame.

I'll bring it on screen.

So as we put Hello, welcome user, let's play me mad libs, share with me your name, and I'm going to put my name to bring this up.

Of course, it's going to exit because we also didn't tell it to pause.

So let's Um, I think we need to cancel that wait for that, let's do another read key concept that read key that's gonna wait for a key press and then it's going to exit the terminal.

So run it again.

Bring it back on screen.

Welcome user.

Let's play a game with Mad Libs, please share with us your name, I'm going to put bros and their prints right back to us the same variable that we put in, which is lets you know that it's actually working.

So now I'm just going to revert back to its original state.

And we can do z Ctrl, z Ctrl Z Ctrl, z Ctrl Z.

So a bunch of times, and we are back woke at semi colon, and we are back to our original state.

And if you don't have control Z, I think on Apple, it's Apple z, I believe.

But if you don't have either those buttons, you can come up to edit and then hit undo up here.

And that will do the same thing that I did with my shortcut on the keyboard.

Also real quick, let's add at the very end of our process, let's add console, console dot read key.

This will make sure that it pauses the application before quits.

Okay, so now over in Python, let's start to get input from users.

So what we want to do here is instead of writing console dot write line, again, it's as simple as prints.

And we can do print, welcome, user, come down to another print.

Let's play a game of Mad Libs, and then another print and say, Please, please share with me your name.

And then we can simply do Neo equals inputs.

Well, technically, technically, we can add this string into input, and it will be the same exact thing.

So we can do this, and it will print and then whatever the next line is, it will get that input.

However, we do need to add a line break here.

Otherwise, it's going to, it's going to allow you to type right after the question mark, we want to go to a new line, just to make it a bit more cleaner.

And so now the cool thing is now that we have our actual name set in the variable, Neo, we can use that with our printing function.

So if we do console dot write line, for example.

Let's interpolate the string and do Hello.

And then we can do here, Neo.

And then exclamation point.

And then let's say something like, are you ready? Are you ready? And then what is something you want to know more what running out of space? So I'm gonna go to next line more about.

He learned how to spell more about.

And then next line, when they answer what they want to know more about, we can put that into the matrix.

So I forgot my semicolon.

So we can do the matrix equals console dot read line.

Easy as that.

And over in Python, it's pretty much the same exact deal.

We'll do print.

What is it when interpolate the string with F? Hello.

And then this will be Neil.

Whoops, Neil.

And then are you ready? Are you ready? And then actually, I'm going to break this off.

Whoops, I'm going to break this up into another print.

Actually, I want to make this an input.

input.

And then this is what is something you want to know, oops, to know more about.

And of course, we need to do the matrix variable equals whatever they want to know more about.

So just to make sure that you're still with me, just remember that the only thing we're currently working on is get input from user.

That's this section right here, everything else we are not focused on.

And within this section, there are only two functions that we're using.

The first one is called to that read line, which is just simply printing some string to the user.

And a second is console dot read line, which will return to us whatever that user inputted into their console, that we can then assign a variable to it.

That's it.

Nothing more complex than that.

So continuing along with our little storytelling, we can have a lot of fun.

And do console dot write line, and then interpolated string, and do something like, ooh, and then we can put you want to know more about, and then the matrix Ha.

You know, just have fun with it.

And then we can do another line console, dot write line, interpolated string.

Let's see.

Next we want to do is we want to get the variable system.

And so we need to give them a bit of a context.

So we can do something like, first, let's see first.

Okay, please bear with me.

Okay, well, first, tell me what you already already know about the matrix.

And then let's do one final one, which gives them a bit of instruction, because this is madlibs.

After all, we're gonna do let's see what now would you categorize the matrix as, and then we can add like a little semi colon here.

And then finally, finally, we can do system equals console dot readline.

And yeah, pretty straightforward.

Again, I'm just trying to have fun with this Mad Libs as we're getting the data, the information, the input from the user.

And so, you know, you also want to give, you know, this is all mad libs clues right now.

But you also want to give the user like some sort of hint as to what word they're replacing.

So I simply just asked what noun would you categorize the matrix as, and he's just trying to have fun with it over in Python, not much really changes, we're just going to print out the same exact strings.

So so Oh, oh, you want to know more about that? I mean, you put the matrix and then print another line.

And this is going to say, Okay, well first, tell me, oops, tell me what you already know about the matrix to another line.

We're in df and then what now? Would you cat TIG Gore, right? Then matrix.

Actually, I forget this is Python.

So we can actually make this our input, and then do system equals this input.

And just to prove to you that we're just trying to craft the story here, nothing more complex than that.

I'm going to initialize all of these remaining variables as empty strings just so that that error clears up.

Because empty string equals empty string, equals empty string equals empty string.

And now we can actually print out this story.

Even though most of the words most of the very roles are going to be whoops, equals empty string are going to be empty strings.

We can print this out.

My console goes over to the left.

So what is my name to Brill's? And then, as we wrote, hello jimbros gave us her name.

Are you ready? What is something Do you want to know more about? There's a typo there.

We can fix that.

I want to know more about pizza, for example.

Oh, you want to know more about pizza? Okay.

Well, first, tell me what you already know about pizza.

What noun? Would you categorize pizza as I categorize pizza as pie.

And then that's as far as we've gotten our code.

So now it does the Mad Libs, it replaces the variables within the actual Madlib story.

And they get we gives us this pizza is a pie two Bros.

That pie is our and then it's all empty strings from there.

But as you see, this is this is all we're doing at the moment is this part of the terminal script, we're just crafting this story.

That's all there is to it.

Hopefully at this point, I've convinced you that we aren't doing anything complex.

With this stage, we're just printing out a story to the console and asking for variables.

That that's all.

So let's just finish off our story by moving on.

So next thing that I want to do here is of course, we're gonna do console dot write line.

And we're gonna interpolate a string.

And what I want to put next is, let's see.

Give me me in opposing, opposing now, to system, right, because the next word we're going to get is enemy, we're going to try and replace enemy ever again, we're just trying to give them some sort of hint for a good noun to replace.

So that should work.

So then we're gonna do enemy equals console.

dot read line.

All right, so hopefully, this string that I printing that I'm printing to the console, is enough to give them a hint.

On a good words, replace enemy with moving on, we're going to do another console dot write line.

And what are we getting next? Next, we are going to get the word inside.

So let's see.

What hint Can I give for inside I don't know relaxing.

Now, let's say now give me any relaxing.

Now, in of course, this needs to be in the present tense, present tense.

And then we can do inside equals console dot read line again.

And we just keep on going down the line, we're not going to get caught up to speed in Python.

So last left off was system.

So we need to print let's see, interpolate a string.

Let's do what is it give me me an opposing now to system.

I always forget this is Python so we don't have to print and then do a read line.

We can just do input.

Let's see what's the variables enemy, right? Yeah, enemy equals input.

Cool.

And then we can do the same thing with inside equals input.

And then I'm gonna interpolate the string.

And then let's do now.

Now give me any relaxing.

Now, present tense.

All right, oops, no, semi colon, none Python.

Cool.

And we are all caught up.

Now next up is the interesting part that we kind of set up a little earlier in the video.

Now we need to actually use our for loop for our string arrays.

And so we can go about doing that really simply just create a for loop for int i equals zero.

i is less than profession, dot length, semi colon i plus plus, and then come down here sort of brackets.

And so this for loop is just going to go through the professions which is next up in the text prompt, and we can simply just asked.

Let's see.

I guess before that though, we need to alert the user say console dot write line and say Okay.

Now I need for professions, professions, professions relating to what is this relaying to system and interpolate the string here, boom.

So we let that alert the user what's about to happen, I need for professional building systems.

And then here we can do console dot write line.

And we're gonna do a course interpolated string here.

And let's do profession.

If I have any typos, I apologize, profession, plural.

Because, again, we're doing businessmen, I don't remember them originally, businessman mckellan, something like that.

But they're an employee rural.

And then we can just simply let them know where they're at, by doing i plus one, because is going to be zero starts at zero.

So we can do that plus one to get it started at one.

And then simply profession dot length.

Right, so what this does, let me just walk you through this thing is a bit vague.

So what this does, simply, as we're going through our for loop, there are four different professions, it's going to write to the console, give me a profession, plural, and it's going to print out what number profession they're currently filling out.

That's all it is.

And then it's divided by the length is how many professions we need.

And I'll show you this example a bit later.

But once we do that, then after every single time, we print that to the console, we want to read line and assign profession of AI to that, and that will pretty much populate our entire profession string array.

All right, and to get caught up in Python, it's not too difficult, of course, we need to write out our print.

And we are currently alerting the player that a for loop is about to happen for the most part.

So okay, now I need four pro fish ones relating to system.

Right.

And then we got to do our for loop.

And for loops in Python are they're a bit different.

So we're gonna do for i in range, length of profession.

And then we'll do our colon and the next line will do the profession of AI equals inputs.

And then here, what do we put we put profession, which is definitely a typo in the C sharp profession.

And then plural.

And then here, we're going to do i plus one, hope this is not interpolated string, and add an F to make an interpolated string, divided by length, oops, come on, come on.

There it is length of profession.

And there we have it.

They are now currently up to speed.

Now this point, I'm pretty sure that you could finish this program on your own because we're just essentially gonna do the same exact stuff we've been doing.

And once you fill out the remainder, what is it like three or four variables, the application is done.

However, I want to take a second to pause because I often don't go this long without leaving comments.

It's always nice to leave comments for yourself in the future.

Or if you're going to send this off to a friend, or if you're going to upload it to GitHub for you know, other developers is trying to take apart and learn from it's always good and nice leave comments.

So let's do that.

Just to explain what's happening here.

I'm just going to say we are getting the matrix variable a variable from user it's going to be a lot of those comments getting system variable variable from user forgetting enemy variable from User where I didn't even add system, system variable from user sorry, getting what is this inside variable? variable from user.

And then this is arms and say commencing for loop.

No way, commencing.

Now I'm going to say that I'm going to say getting getting all professions.

From user.

Also, I know that I have a typo here.

So I'm going to fix that profession.

Yes.

Cool.

I'm actually going to combine these not not.

And yeah, this really helps me out personally.

Oftentimes, when I'm reading code, I'll often look for the green, or like, where the comments are, whatever color the comments are, in the language, often look for those as like kind of like markers.

So I can kind of fill out the code and know exactly what's going on where.

So it's always good practice to leave comments in Python and do the exact same.

And leave a comment here, getting the matrix variable.

From user.

I apologize, if I have typos, I'm not terribly concerned about that getting getting system variable from user, and then this is going to be getting enemy variable from user.

And this is getting inside variable from user.

And this is getting all profession.

variable from user was going to change his profession.

I guess that doesn't really matter.

Cool, a bit redundant, but it always helps.

Alright, so I went and did you a favor and pretty much wrote out the rest of the logic for the rest of the variables, because it probably got a bit too mundane if I were to record it on the screen, but we can walk through it anyway.

So right after the profession's for loop, we are essentially getting the same variable.

And we do that by writing to the console, give me a hero related verb in the present tense.

Again, this is just hints for the user.

So they kind of have an idea on what we're they're replacing.

And then we will save whatever string they returned to us into the Save variable.

And then we get the unplugged variable, which we do that by writing to the console.

Now give me a verb that makes you think about relief in the past tense.

Again, just another hint, you can see how mundane it probably would have been.

And then whatever string they returned to us with counselor reline we will save that into the unplugged variable.

And then after that we need to get our adjectives are two of them.

So we first warn the user say, lastly, I need to dystopian adjectives.

And then we do a for loop.

And simply, we will tell them that they are currently filling out an adjective.

And we'll let them know what number they're on out of the total number.

And then we will save that to their respective adjective variables, whatever string they're returned to us.

And then lastly, we just need to get the fight variable.

And we just say, Hey, we need a verb on the console.

And then whatever string they returned to us, we will save that into the fight variable.

And that's pretty much it on the Python side of things is the exact same just in Python syntax, you know, get the same variable, get the unplugged variable, get the two adjectives to a for loop, and then get the fight variable.

And we're done.

Great work guys are madlibs application is pretty much done.

I mean, there's nothing left to do.

Except there's one thing that I want to do on Python.

So the input function is a bit different than the console dot read line, the constant read line function will always go to a new line, the input does not.

So with that, let's kind of format this a bit.

I'm going to do with all the inputs, semi colon, and then a space.

So whatever question we asked them, they can input that right after our question.

So I'm gonna do that again.

I'm actually going to remove the question mark because it might get a bit confusing with that syntax anymore.

So there's some added space there.

And then input here I'll do colon space.

Here I'll do colon space.

Where else here I'll do colon space.

And this is the input space, there's input space.

Here, space input here, space, and boom.

Alright, and that's just going to look a lot more cleaner when we're actually playing the game in the terminal.

So all that's left is to play it and let's, let's actually play it.

I'm going to run C sharp first.

I'm going to bring this over here and it says welcome user.

Let's play a game of madlibs.

Please share with me your name.

My name is jabril Hello, jabril.

Are you ready? What is something you want to know more about? I want to know more about pizza.

Oh, you want to know more about pizza? Ha.

Okay, well first, tell me what you already know about pizza.

What now? Would you categorize pizza as I'd say pizza is a pie.

Give me an imposing noun to pie.

Hmm, maybe cake.

Now give us a relaxing noun.

Present tense.

I guess sleeping is a relaxed noun and present tense.

Okay, now I need four professions relating to pie.

Ooh, I don't know.

Baker.

Cook.

Chef.

I don't know.

I don't know.

What's the last one? I'm just gonna say butcher.

I don't know.

Give me a hero.

Related verb in present tense.

Here are related verb in present tense.

Let's see.

Save.

That's all I can think of.

I know that's the actual word, but it's all I can think of.

Now, give me a verb that makes you think about relief.

Massage.

Massage in past tense massage.

Yeah.

Is that a verb? Something to do? I guess I don't know.

Lastly, I need to dystopian adjectives describing words.

I don't know birds, I guess.

And what's another one? I'm dirty.

And the verb, a verb is what you do, let's say, um, what you do, kick.

Let's see what we got here.

Pizza is a pie two rows.

That pie is our cake.

But when you're sleeping, you look around.

What do you see? Baker, cook, Chef, butcher, oops, I didn't listen to instructions socially plural, very minds of the people we are trying to save.

But until we do, these people are still part of that pie.

And that makes them our cake very deep.

You have to understand, most of these people are not ready to be massaged.

And many of them are so burnt, so helplessly dirty on the pie that they will kick to protect it.

Art, absolute art.

And now let's play in Python.

Real quick.

Not sure how I missed this.

But we need to put input at the bottom so the console will stay open.

But it's a bit different to actually play it with Python.

Go up to here up the top where your project file name is right click and then do reveal an explorer.

And then wherever your fault your file is just double click it and a terminal should pop up.

It should look pretty much the exact same, just with a slight Python syntax difference that we did.

And so please share with me your name? My name is what am I gonna say? My name is fajita.

I'm cool this time.

Hello Vegito Are you ready? What is something you want to know more about? I want to know more about Um, let's see.

Not pizza.

Oh, no more about Skittles.

Skittles huh? Okay, well first tell me what's your I know about skills? What now? Once you category Skittles, as I'd say it's candy.

Give me an imposing noun to candy.

Ooh, veggies.

Now give me any relaxing noun in the present tense, relaxing noun.

Person place or thing? That's actually probably incorrect, but I understand what it's asking.

Relaxing now.

I don't know.

Relaxing itself.

Okay, so now I need for professionals relating to candy.

Let's see.

Baker.

Down Mama.

Clerk.

I don't know.

Supposed to be plural.

I keep forgetting associate plural clerks.

Baker.

I don't what do you call it candy make candy makers candy.

Make Here's chocolate chocalate factory owners.

Let's see, give me a hero relating verb in the present tense.

What do heroes do they save.

They fight crime.

The verb Fight, fight crime.

fight crime.

I don't know.

Now, give me a verb that makes you think about relief.

coding.

That's what you do in past tense coded.

Lastly, I need to dystopian.

Let's do dystopian, let's do, empty, I guess.

And let's do dark and a verb, a verb.

Slide.

Let's see what we got here.

Skittles is a candy fajita? That candy is our veggies.

But when you're relaxing, you look around when you see bakers, clerks, candy makers, chocolate factory owners, the very minds of people, we are trying to fight crime.

But until we do, these people are still a part of that candy.

And that makes them more veggies very deep.

That is so deep.

You have to understand, most of these people are not ready to be coded.

And many of them are so empty.

So hopelessly dark on the candy that they will slide to protect it.

Wow.

Wow.

So that's poetry.

And there you have it, guys, congratulations on creating your first ever program.

You did it.

Congrats, everyone.

Believe it or not, you just written an actual usable program, you can go right now and play this with your friends and loved ones and impress them with your new skills.

But if you're still lost, you should feel really lucky.

Because this video is part of a programming course that I put together to teach you everything that you need to know to start programming.

And I promise by the end of it, this application will be very easy for you to understand even without my help.

I envy all the knowledge that you get to learn.

So maybe there's some things that you understood and others that confused you.

Well, I designed this course that you only have to take the lessons that you want to take no prior lessons required to make your own curriculum.

So what are you waiting for? Now, if you want to be a good programmer, it's very important that you get a solid understanding on data types.

So let's talk a bit about them and get you familiar with the basics of them.

On the most fundamental level, let's say you have some data that is stored in a variable.

Well, this data has some sort of type that's associated with it.

There are a good number of different data types, and they all have different instructions and rules.

And this is sort of computer knows what it can and can't do with the variable.

Now there are six main data types that are shared across most languages.

bool, which stands for Boolean named after the 19th century mathematician George Boole whose work popularized it char, which stands for character string, which stands for string of characters int, which stands for integer float, which stands for floating point value, and array, which isn't actually a type of data.

It's a data structure.

But by definition, it's an ordered series or an arrangement of similar types of data.

And no, there are more data types that exists out there.

But if you want to learn more about these in particular, I've a lesson on each and every one of them, check the link in the description, because this lesson, we're only briefly go over them.

Now, again, every single one of these have their own unique set of rules and instructions.

For instance, let's take a look at the integer data type, which are a type of data for whole numbers.

Let's say that you have an integer that equals 11.

And you want to minus one from it, well, you'd write off this operation, send it to the computer to perform.

And guess what your computer will take a look at this operation, then we'll look to see if it has the instructions for doing that operation, then we'll go Yeah, I know how to subtract an integer from an integer, the computer will then subtract one from 11 and then send back to you a 10.

all well and good.

everything checks out.

But now let's take a look at a string data type, which again, is a string of characters.

If you were to have the string 11, and you want to subtract the integer one from the string 11.

Well, you send this operation to your computer, your computer would take a look at its operation, then check to see if it has instructions on how to do that or not, then it would realize what you sent it makes absolutely no sense.

It has no instructions on how to subtract integers from strings.

This is no different from telling your computer to subtract one from the word hello.

How do you do So your computer will just send back to an error letting me know that the operation you're trying to do makes no sense.

What specifically in this case is a type error.

Now, let's do the same operation, but instead make both of them strings.

What do you think will happen? Well, we get attending in but as a string, maybe we'll get another error.

Well, if you again have the string 11, and you send the operation to your computer to subtract the string one from the string 11, your computer will look its operation, then again, realize it has no instructions on how to do this, thus, returning back to you in air.

But you may find this next part quite interesting.

If you instead tell your computer to take the string 11 and plus the string one to it, it will look at this operation, then check to see if it has any instructions on how to do this or not.

And then say, Yeah, actually, I can do that for you, then it'll send back to you a string of 111 simply because since the string one and the string 11 are both strings, all it has to do is add an extra one to the 11th string, just for example.

And there you have it for data types.

That is why understanding data types is really important, you will have a very hard time trying to write programs without knowing the difference between a number as an int, float, or string.

Check out the lessons LinkedIn description to learn more about each data type individually.

But in conclusion, just remember that data types are different types of data with different rules and instructions.

And depending on the data type of your variable, there are certain operations that you can and can't do with it, which will become very important to grasp and understand as you start using them.

So let's talk about bulls bull is short for Boolean.

If you hear bull or Boolean, they mean the same exact thing.

And it was introduced by George Boole in his book The mathematical analysis of logic in 1847.

But what is a Boolean in terms of programming? Well, a Boolean is a data type that can only be assigned one of two different values, either a true value or false value.

And that's it, it honestly doesn't get any more complex than that.

And what might take you by surprise is that bullions are the most fundamental building block for programming, most of your code will simply just check if something is true or not.

And complexity is added by combining a bunch of volumes.

But we'll get into that in just a bit.

But for now, let's get into the nitty gritty on how you go about using volumes.

And we're going to do this by using two different languages.

Because I think it can be really helpful for you to learn how they compare and contrast.

And plus, you'll pretty much learn two languages at once.

So on the left is language C sharp using the it Visual Studio, which should interest you if you want to do windows development, or if you want to make games using a popular game engine called a unity.

And on the right is the language Python three using the ID Visual Studio code, which should interest you if you want to get into general programming or data science.

Alright, so here I have two brand new console projects.

And if you don't how to make a new console project in either C sharp or Python or both, be sure to check out the video in the description.

It's called How to install an ad.

And at the end of that video, I'll show you how to do that.

Alright, so the first thing I want to get into today is just some basic Boolean syntax.

So first thing I'm gonna do is just delete these two lines don't need them, they come standard with every new C sharp project.

And then I'm going to cast a boolean data type, bowl, and then I'm gonna create a variable called pizza time them assign it to be true.

Now, the first thing that you know about Boolean is that they only have two states, they can either be true, or they can be false.

That is about the only flexibility that a bullying has when it comes to assigning it.

But over in Python bullions have just a little bit more flexibility.

So I'm going to create a new variable, and we'll call it pizza time, of course, I'm gonna assign a true value to it.

And now it knows that this is a Boolean, but I can also assign a false value to it.

Or I can also say, assign a one value to it, that equals true.

And lastly, I can assign a zero value to it, and that equals false.

And just to prove it to you, I'm going to show you all the different cases.

So we'll do true here.

And then to check it, we need an if statement.

So I'm gonna say if pizza time, then we need to print pizza, or a string pizza.

Like that, I'm gonna hit the play button and you'll see that it prints out pizza.

Next, I'm going to change the false value, and it should print out nothing.

If we hit the play button.

You see nothing was printed just as we expected.

And now I'm going to change this to be a one value and hit the play button.

You'll see that again we get pizza pretty nice.

And lastly, I'm just going to say pizza time equals zero save it hit the play button and you see that we get nothing printed.

So what's going on here because Clearly the pizza time variable is an integer.

And we're saying if zero, then print pizza time.

That doesn't make any sense, right.

And that's one of the benefits to Python being an interpreted language, it allows you to pass in integers in a conditional statement.

And if it's zero, then it's going to convert that into a false value.

But if it's one, it's going to convert that into a true value.

In fact, any numeric value that is not zero, and it's being used as a conditional statement will return a true value.

So Pete's time equals nine, save hit play, you'll see that it prints out pizza, pizza time equals negative three, hit save, hit play, still prints out pizza is in this isn't only limited to integers, you can also use floats.

So if we say pizza time equals point 0000001, hit save, you'll see here pizza time is now a float, we hit play, and still it will print out pizza.

And this is unique to Python, we can't even think to do that in C sharp, if we weren't even tried, we get all sorts of errors.

So that's just one extra flexibility you have with using the language, Python, font and crease.

So now I want to get into the many, many, many operators that bullions have, which is just a testament to how powerful these things are.

But let's start with the equality operator.

Now, let's say that you want to create some like user login system, right.

So I'm just going to create a couple of strings here.

I'm going to say string, password type some su p T stands for password typed, I'm going to say equals ABC 123.

And then let's do another string of semi colon Of course, and then do another string.

And this is going to be P A for password actual.

And we're going to say equals, again, ABC 123.

Okay, so let's say that this is the user's actual password PA, ABC 123.

And what they typed is ABC 123.

So how can we check to see if they match? Well, we'd have to use something that's called the equality equal operator.

And the equality equal operator looks like this.

pt, equals PA.

And that's all it's to it.

Now, I know what you're thinking, this looks really confusing.

And I've been programming for about 13 years now.

And I agree with you.

So one thing that I usually like to do with my bullions is first and foremost, I like to put parentheses around whatever is like the Boolean then I'm checking for, it just makes it a lot easier to read when I'm scanning lines of code.

But to explain to you what's going on here, again, equals equals that's two equals back to back is what we call inequality equals Operator, do not get confused with one equal one equal is simply just the assignment operator, it means that you want to assign something to a variable to equals, again, is checking if two things equal each other.

So if we were to read this full line, we're simply just initializing a boolean variable called pizza time.

And we're assigning the value true or false to it with this Boolean operation here.

And what this Boolean operation simply does is it just checks if p t is equal to PA.

If it is then pizza time will equal true.

But if it's not, it's going to return a false and piece of time will equal false.

I mean, pretty simple, right? We just asked if two things equal each other.

If it is, then give us a true if it doesn't give us a false.

And as simple as this is, if you've ever logged in to anything before, this is pretty much all they're doing with maybe a couple extra checks on top of that.

All right, I think I beat that horse well enough.

But I keep on hammering this in because it's really important that you understand this step.

If you understand what's going on here, then I think a lot of programming is going to be really easy for you to understand, because this is like one of the staples to programming.

Moving on.

Just to prove to you that this works, as I am saying that it does, we're gonna come down here and do a console dot write line, just print this to the console, pizza time.

And then we also need a console dot read key.

This just makes sure that the console doesn't immediately close when we run it, hit the start button up here.

And then I'm going to bring the console on screen.

And as you can see, it returns a true value.

But if we make one of these slightly off, if I turn this to be one to four instead, and we hit the start button, you can see that whatever returns to us is a false value.

So it is not pizza time because they do not match they are not equal.

And now over in Python, I'm just gonna quickly recreate the same scenario.

It's time equals, well, we need some for that we need p t equals A b, c 123 p p A equals equals a string, ABC 123.

And then pizza time equals P t equals P oops, p a, like that go on to add the prince, let's do print pizza time here.

And then I'm gonna hit the play button and return to True Value perfect.

And of course, I can make one of these slightly off, and then hit the play button and returns a false value.

Now, I really hope that all that made sense, because if it did everything from this point on, it's gonna be really easy to understand.

But next, let's move on to our next operator, which is the equality not equal operator.

And how the equality not equal operator works is, let's say that you want to check for like, some bad word, right? So we're gonna change pa to be bad word, right.

And so instead of checking if they are the same, you're going to check if they are not the same, and not is going to be indicated by a exclamation point.

Now, what this is saying is, if they do not equal each other, then I want you to return a true value.

However, if they do equal each other, then I want you to return a false value, it pretty much just flips the Boolean operation, which again, is what we want in this scenario, because we're trying to filter out bad word, if what you typed is bad word, then it's not pizza time.

And just to prove to you that this will return to true because they do not equal each other, I'm just gonna hit the play button up here, and then bring the console on screen, you can see that it returns a true value.

So that's pretty much everything that you need to know about the equality operators.

Next, let's get into the relation operator, starting with the greater than operator.

So imagine that you have some login system, and you want to limit the amount of times that a user can log in, Well, one thing you can do is use one of the relational operators, let's just start with a greater than.

So first thing, let's just ignore these two variables for now and create new ones, we're gonna make an integer, I'm gonna call it a log attempts, equals, let's just say it's three.

And then let's make another integer and call it log max equals five, for instance, right, so what we can do is come down to our pizza time Boolean, and we can replace this with log Max is greater than log attempts.

And what this is doing is it's essentially checking if log Max is greater than log attempt.

And seeing as log Max is five in log 10 plus three, this is going to return a true value for our pizza time Boolean variable.

And just to prove to you that this is correct, I'm gonna hit the start button, bring the console where you can see that we have a true value.

So that's the greater than operator, we could also use the less than operator, which is going to check if logged Max is less than log attempts return a true value if that is true or false value if that is false.

But there's also a greater than equals to operator, which just checks both if it's either greater than or equal to the log attempts.

And finally, of course, there is the less than and equal to operator that will check if log Max is less than or equal to log attempt.

And over in Python, these operators don't change at all, I'm just going to get up to speed I'm gonna do log attempt equals three and log max equals five and then come down to our pizza time go in and do log Max is greater than log attempt.

And then I'm going to run that just to prove this works the same.

And voila.

And the last operators I want to go over are the end and or operators.

So here is where you really can be able to see the power of bullions being demonstrated.

Alright, so let's bring back our old scenario.

So we're going to change this back to ABC 1234, past actual, and then our past typed is also ABC 123.

And let's replace this Boolean operation with P t equals equals that is our equality equal operator equals P a.

So what if you want to check if the password is a match, and they're under a certain number of login attempts? Well, we can use our and operator and in C sharp It's done like this, you just type the an ampersand, and then another and an percent.

And that is the end operator.

And then after that you can do, you can write out another Boolean operation.

So we're gonna write log attempt is less than log max.

And so what this full Boolean is asking, it's just pretty much asking, do our password typed in a password actual do they match, and the two ampersands.

And are we under is the our log attempts less than our log max.

If true, if both of these are true, then return a true value for a pizza time.

But if either of them are false, doesn't matter which one, then return a false value for our pizza time.

And just to prove to you that that is how this operation is done, I'm going to press the start button top and bring the console and open, you can see that we have a true value here.

And all it takes, all it takes is for one of these to be false.

And I'm just going to change this to be passed, or ABC 124.

And then we hit save, and then I'm going to hit the start button and bring the constant window over here.

And you can see that we have a false, even though one is true, we're asking for n.

And that means they both have to be true in order for pizza time to be true.

And just a quick side note, I generally like to use a lot of parentheses as many as possible.

When it comes to Boolean operations like this, I like the segment because it just makes it a lot easier for me to read, when I'm just going through lines of code, parentheses like me know, okay, this Boolean operation here, I see that and I know there's another one, it just makes it a lot easier for me, even sometimes I'll do like an overall parentheses over the entire Boolean operation.

It just helps me read it a lot easier.

I don't know if helps you or not.

But that's a tip that you could use.

And over in Python, the syntax is just a little different.

So I'm just going to get up to speed going to change this back to pass 123 or just not pass is it as ABC 123.

Sorry, ABC 123.

And then we'll change this to be P t equals equals p a, or did you not tell since for me, and the way that we do in an in Python is you literally just typed out the word and, and log attempt is less than log Max, boy, that has became a really small window, maybe I should send out just a bit.

Cool.

So now I'm just gonna prove this by hitting the play button.

And you can see we got a true value.

But yet again, all it takes is one of these Boolean operations to be false.

And they the entire thing becomes false.

And I'm proving that we'll change this to four, hit the play button, and we got a false value returned to us.

But what if you want him to be a merciful social media developer, right, where you don't care if they get one or the other wrong, as long as you get one of them wrong.

First of all, don't ever do this.

But if you want it to do this, you would simply just change the AND operator into an OR operator, and then C sharp This is done by replacing the two ampersands.

With two vertical lines.

I'm not sure what these characters are called.

But you replace it with two vertical lines, it's on the same key that the backslash key is on just looked it up, I guess it's called the vertical bar character never knew that been anyhow, this will now check if either one were true, which we know that one of them is false, because p t does not equal PA.

But the second one is true because log attempts is less than the log max.

And to prove that this will return true because one of them is true, I'm going to hit the start button and then bring the window over you can see that we have a true value returned.

And over in Python, the OR operator is just a bit different, just as you write out and for the an operator in Python, you have to write out or for the OR operator in Python.

And now over in Python, the OR operator is just a bit different, just like how you had to write out an for the an operator, you have to write out or for the OR operator in Python.

And of course, just to prove that this works, I'm gonna hit the play button up here.

And you'll see we get a true value returned.

So I hope you can see what makes Boolean so powerful in the world of programming.

Just from this simple example alone, we already have a Boolean that checks for the log attempts next to you know, the actual password typed.

And then we can take this Boolean and embed that into another Boolean and just keep on adding complexity and complexity.

Billions are incredibly powerful and and they're really important to understand.

And yeah, there you have it, guys.

That is pretty much everything that you need.

To get started programming in regards to billions.

So strings strings are one of the most important ingredients to almost every program you'll ever make.

Why? Well, the odds are likely that at some point in deployment or even during development, some human will have to interface with your application.

And with that, your program needs to communicate with them somehow.

And it's highly likely that using strings will be how you go about doing that strings on the most basic level are a string of characters together in a series, hence the name string, you can write any word in any language, you can write any number, or even any code slang key, you name it, making strings, incredibly powerful.

And that's pretty much all that's the strings, they're really easy to get your head around.

And there are a few things that are really good to know while using them.

So let's take a look at a few examples.

Now we're gonna do these examples using two different languages, because I think it can be really helpful for you to see how they compare and contrast.

And plus, you'll pretty much learn two languages at once.

So on the left is the language C sharp using the it Visual Studio, which should interest you if you're gonna do windows development, or if you want to make games using a popular game engine called unity.

And on the right is the language Python three using the ID Visual Studio code, which should interest you if you want to get into more general programming or data science.

Alright, so here I have two brand new console projects.

And if you don't how to make a new console project and either C sharp or Python, or both, be sure to check out the video in the description.

It's called How to install an ad.

And at the end of that video, I'll show you how to do that.

Alright, so the first thing I want to get into is some basic string syntax.

So first, I'm going to delete these lines, they come stock with your brand new C sharp project.

And then I'm going to initialize a string, we'll call it a just for example.

And then if you want to assign a value to a string, you have to use double quotes.

And then you can type in whatever string you want, and then semi colon at the end.

And as far as C sharp string syntax is concerned, that's all you will need to worry about just the double quotes, make sure they are double quotes.

Now over in Python, we have just a little bit more freedom.

So I'm going to initialize a string here.

And then I'm going to assign hello to it.

And as you can see, I use a double quotes just like we did in C sharp, but you can also initialize a string and assign Hello, with the single quotes as well, both of these will be counted as a string within Python.

And just to prove that I'm going to do print a and then B.

Here we go.

And there you have it, hello, and Hello, both are counted as strings.

In fact, today, you're going to find that this freedom right here, the double quotes in single quotes can be assigned to a string is quite nice, Yossi.

And so the next thing I want to talk about is the fact that strings are arrays of characters.

And to demonstrate that in C sharp over here on the left, we're simply going to do a console dot write line.

And then I'm going to do a and I'm going to use the brackets and just put a zero in between them.

This, this is an element within the A array.

Again, strings are an array of characters.

So I'm just asking for the zeroeth element from the A string array, which this is zero, this is one, this is 234.

Arrays always start on zero in pretty much every programming language.

And so now just to prove that, I'm going to hit the start button up here to run it in Africa, I always forget to do console dot read key, this just makes sure that the terminal stays open until we press a key and hit start.

And then bring this over here and you see that we have the zeroeth element in the A array that is again a string of characters, which is H.

And it's quite flexible, we can put any that we want in here as the exercise.

So if we want to get zero, we can still be count this is zero, and then he is 1234.

So if we put four in here, then when we hit the start button, you'll see that it prints out in Oh, in fact, this technique is what a lot of game developers use when they're trying to create some chat system that pops up one character at a time, they will pretty much write out the entire dialogue here like Hello, welcome.

Welcome to my store.

And then they will write some function that will take in a string and then we'll grab every single character and then we'll print one out with a pause near like a second pause probably a lot less than that, like a 10th of a second pause, then print the next 1/10 the seven second pause, print the next one, so on and so forth.

Just A little add on there, and over in Python, I'm gonna get rid of the B, we're just going to keep the double quotes convention to match with C sharp, given the B here, and then I'm actually just going to do a print.

Let's do zero first, hit the play button, you'll see we get an H.

And again, we're going to do a four.

So we can get the O hit the play button, and Oh, I forgot to save it, and then hit the play button.

And then we have Oh, right there, pretty much the same in both languages.

Again, just remember that all strings are just a array of characters.

Next thing I want to talk about is using the addition operator with strings.

And to demonstrate that over here in the left, when C sharp is going to remove this Bechtel, we had it, remove this from the right, and I'm just going to come down here and do a plus equals oops, plus equals, that's the addition operator, these two right here, when you see plus equals, that is an addition operator, plus equals and then just add a character exclamation mark to it.

And then I'm going to print that, and you'll just see that it's gonna be Hello, and then I'm just gonna add a little exclamation at the end.

Start that up, bring it over here, and voila.

Now one cool thing about this process is because at the fact that the string a is just an array of characters, using the addition operator pretty much just says, Take that string of characters and add this character to the end of it.

However, the cool thing is, you aren't limited to only adding characters.

Again, the single quotes denotes a character double quotes, and that denotes a string.

So we could add to the end of this world, for example.

Now, of course, we have to change these single quotes or double quotes to let C sharp know that this is now a string.

And what this is going to do is, it's now going to add every single character in this, this character array, or this string is going to add every single character to this string.

And just to prove that, I'm gonna hit start, and then we'll bring this over and voila, hello, world.

Alright, now over in Python, I'm just going to restore this back to its original state, then do a plus equals exclamation mark.

Now, of course, this is just going to take the Hello string, the A string, add an exclamation point to it, and is going to print that out with the play button to confirm come down.

And that exactly what we got.

Now, I want to again reiterate that Python doesn't care if you use double quotes or single quotes for characters or strings.

So unlike C sharp, we could just put world right in between of two single quotes, and it will we hit play, it will print out for us without giving us any errors or any problems whatsoever.

That's just one of the benefits to using an interpreted language.

If you want to use single quotes or double quotes, that's pretty much up to you your own discretion.

But just to keep everything consistent, we're going to use double quotes for strings as well, for this lesson, not before we move on, you might be wondering, oh, well, if we can do addition operator, what if we use like a multiplication operator or subtraction operator, a division operator? Well, unfortunately, the addition operator is the only arithmetic operators that you can use on strings.

So don't get too happy.

Now, escape characters are actual characters, so I'm not gonna go too deep into them for this lesson.

But they're pretty important to string sing as strings are an array of characters.

But let's just look at a few of them real quick.

So I'm just going to add a few of them here.

I'm going to do backslash in.

And then I'm gonna do backslash T, I'm gonna do backslash, single quote, backslash double quote, and then backslash, backslash.

Now these are, what is that five are the most popular escape characters.

The first one, this is new line, this is a tab.

This is single quote, this is double quote, and this is backslash.

And I'm going to just print out this to show you that what they do, hit the start button, and then bring this over.

And so you have a new line, which is the backslash, N, and then a tab, which is backslash, T.

And then you have the single quote, which is backslash single, quote, double quote, which is backslash, double quote, then you have backslash, which is backslash, backslash.

And these bad boys are handy because they help you do some things that are probably not intuitive when you first start coding, for example, like how do you press Enter when you have just strings or how do you use double quotes of strings required double quotes to initialize right so for example, I'm just gonna get rid of all these.

Just give you a quick example.

I'm going to use the escape character, double quote at the end and it looks good.

Kill character double quote at the beginning.

And this is going to look like hello in quotes, I'm gonna hit the star button, and then bring this over.

And there you go, you've escaped from the syntax of strings by using the escape character.

Again, I went over this pretty briefly in this lesson.

But if you want to know more about that, check out the lesson I did on characters, and I go a bit more in depth about them.

So I'm just going to restore this back to how it was before I move on to Python.

Now over in Python, the syntax for the escape characters are the exact same, I'm just gonna get rid of this line.

And then just add them just as we have in C sharp, backslash t backslash, single, quote, backslash double quote, and then backslash backslash.

Make sure to add that double quote back.

And yeah, there you have it.

One cool thing about this is actually a Visual Studio Code addition is that it will change the color of the escape characters in your string.

So that's pretty handy.

I'm just going to print that out, we should get similar results.

And there you have it.

Alright, so the next thing I want to get into is interpolated strings.

Now, there is no reason for a man to have so much love for a syntax, but I absolutely love interpolated strings.

And here, you'll love it too.

here's, here's what's going on.

Okay, so say we wanted to deliver some message, right? I'm gonna get rid of all this and do like Hello, name.

How are you? Right.

Now, let's say you didn't want to have actual name here.

You want to have like some user input name, right? So let's create a new string for that name.

initialize string make it name equals job Brill's.

Right.

So how you would do this normally is you would segment this string, you would do this and you would delete this here and you would do plus, plus name, and then plus the string again, right, so you have three different strings, but you have to break it apart to put the the string variable here, and then you stitch it back together by plussing the last half of the string.

I mean, listen, it works, it'll get the job done.

But when you have to write a lot of strings like this, over time, it just gets really tiring and easy to get frustrated.

But that is where interpolated strings come into play.

First, just to prove to you that this works, I'm just going to hit the start button.

And then we're going to bring the screen over here and bada boom, it works fine.

But with interpolated strings, now we no longer have to segment the strings anymore, we can bring this back together as one string, and then simply come to the beginning of our string and add the dollar sign.

This dollar sign denotes that the string is now interpolated.

And what that allows you to do is in the middle of strings, you can add brackets, and inside of those brackets, you can add variables.

And so now when I print this out, check this out.

This is so exciting.

Now you have the same exact thing, it's just that you didn't have to break up your string, I love interpolated strings.

So you can imagine if you have like a really long text or something like that, and you have a lot of variables that you need to inject into that text, you can simply just turn a string into an interpolated string, and just you know, add the brackets and your variables all over the place.

And it saves so much time.

And it's just beautiful.

I love it.

No run Python, it's pretty much the same thing.

I'm just going to set this up and say hello name.

How are you? And the only difference in Python though, is instead of $1 sign, you're going to use an F for interpolated strings.

And so now we have the creator initializer name variable.

This is going to be jabril Rose.

And so now we can do the same thing use the brackets and bada boom, hit play just to prove it to you, and hello to Brill's How are you so beautiful, I love it.

And so the final thing I want to go over is just a few handy functions that come with the string data type.

And to demonstrate these handy functions, I'm going to get rid of this line, it's no longer needed.

And the first one I'm going to show you is a lower casing function.

So we can just do name equals name dots to lower end C sharp to lowers the method and use call that add the semicolon.

Then we come down here and then just print out the name.

And what's going to happen is it's going to take the name and then it's going to do it's going to lowercase every single character within the name.

It starts to prove that bring the window over here and you'll see that it has turned this into all lowercase letters.

This can be quite handy when Perhaps you're creating like a database of users or something like that and you don't want duplicates, then no matter what name they pass in to your database, you'll lowercase it every single time and then just do a match against those.

That's one of the most common use cases for that function.

But it's always good to know just in case you need it.

Next, I want to show you the reverse of that, which is an upper casing function.

And instead of starting over completely, I'm just going to add on to our console logging.

So under the first write line, I'm just going to do reset name back to equal to Brill's.

And then we're gonna do name equals name.to to upper is the function in C sharp.

And then I'm just going to copy this Ctrl C Ctrl V.

And now it's going to first print to the console it and all lower, and then all upper and approve that I'll hit the start button, and bring it over.

And voila.

Next up a really, really, really useful function that comes with the string data type is the split function.

So I'm going to reset name, I'm gonna say name equals I'm do a little bit different this time, though.

jabril is what the comma in the middle because we're going to use that as our character that we're going to use to split the string apart.

So with this, we because we're splitting the string into two, we need to have an array instead.

So I'm gonna say, string, and then add the brackets, let a note, let the C sharp know that it's an array, and we'll call it name to equals, and then this we're going to name dot split, and then we'll pass in the character, we want to use the split as gonna be the comma.

And then we can simply just come down here and do console dot write line, and name to.

And then we want to do the first element of that array, which is zero.

And that is the copy and paste.

And then we're going to print the second array element from that array, which is one, and approve that it is going to split this I'm going to hit start here.

And then I'm going to bring the window over and you see that it's split the name based on the comma, jab, reals, beautiful.

And the final handy function I want to show you is the contains function.

So I'm just going to do name equals, I like the spaceship.

I don't know, I like the spaceship.

And then we need a Boolean because contained returns a Boolean.

So Boolean, we'll just say does, and that equals name, dot contains, and then we need to pass in a string here.

And then we're gonna say the does this contain the word the in it and then simply we just do console dot write line does.

And then just to prove that this does return a true value, if it returns, if it has the word the, in the string, I'm going to hit start, and then bring the wind over.

And you see the last right here it was returned a true and yeah, contains is just another really powerful function that comes with the string data type.

Really good use cases for that, and always good to know.

And over in Python, it's just a little different than how they do it in C sharp.

So we ever named here we're gonna do name equals whoops, equals name, dots.

Lower.

Huh.

And we're gonna do print name here.

We're gonna print that out, press the play button, show you that it lowercase is the name, just as we expect.

And then the next one, I'm going to do name again equals to Brill's, and name equals name dot upper function, and then print name again.

I'm going to print that out.

And you'll see that we have all lowercase and then all uppercase.

And now this next string function is going to really demonstrate how Python has a bit of an edge over C sharp in this regard.

So we're going to do name equals the same jab and then rails.

And then here, all we have to do is name equals name, dot split, we're just reassigned name and it will instantly turn this into an array.

That easy, reassign it and then all we have to do then is just to print name and to prove them and hit the play button.

And there you have it jab rails.

Yeah, personally, this is one of my favorite reasons for using Python is because of the ease of doing stuff.

Like this versus over in C sharp how we had to have our string name, we had to initialize a new string array to hold the new string array we're about to make and then printing them out one at a time.

This is just like three lines of code.

easy, simple.

One of the advantages that I love using Python, and the final one is the contains function.

So it doesn't do name equals I like the space ship.

And then come on down here, and then do does initialize a Boolean called does.

And then we're going to do name dots.

Contains, I'll explain why this looks weird in the second, and then the, and then we can print does, alright, and just to prove that works can press play, and it does not work.

And that is because of course, I forgot to save it.

So hit save, and then hit play, come on down, and there you have it true value, I really just want to pause for a second here and emphasize that Python really doesn't care if you use double quotes or single quotes.

As you see, we're using double quotes here for the name and single quotes for the string that it contains.

And it still returns true, it just interprets.

Now, the reason why this part looks so ugly, is because this is what's called a wrapper method, or a method wrapper rather, and it's not important for you understand what that term is yet, in your early days of programming, but essentially what this is, the Python doesn't want you to use this way.

How they prefer you to use it is if you were to go if and then the in name.

So if the string the is a name, then we'll do print does.

Python really prides itself on you know, being a language is kind of close to how we actually, you know, use language as humans.

So this is how I prefer for you to use this, this, this, this method rather.

And just to prove that we're gonna hit play, we'll make sure it's saved and hit play, and we should see two trues, which we do and that doesn't guys, that's pretty much everything that you need to get started with programming in terms of strings.

char data types are pretty easy to grasp.

char is short for character.

And if you know how to read and write in any language, then you know what a character is.

first letter, your name, character letter, you gotten math class character, that hashtag symbol that you overuse on social media care, reg dir, any letter from any language, any single digit number, any sign or symbol, even some glyphs like the yin and yang sign or a single character.

But that's a bit beyond the scope for this course, just keep this in the back of your mind for when you want to learn more about them.

But for now, just know that characters are very important in the world of programming this year, a lot of overlap with a string data type, because a string of characters is what makes up a string.

In fact, way back in the early days of programming language, language, C strings didn't even exist as a data type, you instead had to create an array of characters, but strings like desktop downloads c colon backslash program files that all your applications are installed in are all a series of characters that computers use on a daily basis to make your computer experience as smooth as possible.

Characters play an essential role for computers being able to communicate and relay information to us.

And that's pretty much all there is to it.

Now from here, there's not really much to go over.

But let's have a quick look at how we go about using characters in two different languages.

Because I think it can be really helpful to see how they compare and contrast.

And plus, you'll pretty much learn two languages at once.

So on the left, it's a language C sharp using it Visual Studio, which should interest you if you want to do windows development or want to make games using a popular engine called unity.

And on the right is language Python three using the ID Visual Studio code, which should interest you if you want to get into more general programming or data science.

Alright, so here I have two brand new console projects.

And if you don't know how to make a new console project, neither C sharp or Python or both, be sure to check out the video in the description.

It's called How to install an ad.

And at the end of that video, I'll show you how to do that.

So first things first, let's look at some basic char syntax.

So over here on the left, and C sharp is going to remove that that come standard with your blank console project.

And then I'm going to write char which is casting our data type.

And then we're call our variable a, and I'm going to assign a z character to it.

Now, this is how you write a character a character in C sharp must always be in the middle of two single quotes.

And it's really as simple as that we can put any character we want in here we can put a we can put j we can put eight, we can put the dollar assign any character you want can go in between these two single quotes, and there you have a char.

Now over in Python assigning chars is just a little bit different.

So we can do just as we do in C sharp, we can do a equal single quote z.

However, we can also do a equals double quote, and z.

And Python will set either one, and it will figure out that these are both a char.

But you'll see if we go back into C sharp, and then change these from a single quote, to a double quote z, you'll see that we'll get a type error.

The in C sharp, it specifically uses double quotes for strings, and single quotes for chars.

But again, in Python, it's pretty smart, we're figuring out you know, if it's a char, or a string, one of the benefits to an interpreted language.

And just to prove to you that this is the case, I'm going to actually change this to variable b.

And then we're going to do Print A, and then we're gonna do print B.

And we're going to hit the play button up here in the corner, and you'll see down here in the output, it prints both of them.

Zizi, no problem.

I'm gonna change this back to single quotes real quick.

Right? Okay, so now with the basic char syntax out of the way, let's talk about escape characters.

Now, what are escape characters, there will undoubtedly come a time where maybe you're writing out some story or creating like a list of names or something like that.

And you will undoubtedly come across the question, How do I press Enter? Or hit tab or insert quotes? How do I do these things? Well, that is where escape characters come into play.

Alright, so now let's initialize an escape character, I'm just going to cast a new variable as a char.

And then inside my character, I'm going to hit backslash.

Now technically backslash is the escape character like to escape the syntax of characters.

But I like to call the whole character as an escape character.

It's in, it's up for debate.

But I'm going to hit backslash in which is one of the most common escape characters called new line.

Now, I really want you to understand how important escape characters are.

If I were to, for example, replace the backslash with forward slash, for example, you see, they will get an error down here for too many characters and character literal.

Everything within the single quotes is what's called the character literal.

And you can only put one character per character literal, these count is two.

But when you put the backslash, that counts as one character literal, which, again, this is a new line escape character.

And just to prove to you that it actually does what I claimed that it does, we're going to do console dot write line, this is just going to print up the terminal for us, I'm gonna do a print A, which is a variable that has z in there, and then we're gonna do another woman to A, B, and then I'm just copy and paste Ctrl C Ctrl, V, and then we're gonna do another a, so what we should see is in a print out z, and then new line, and then another z, I'm just going to run that.

And it's off screen.

Oops, I forgot I have to also do console dot read key, otherwise, the console will not stay open.

So hit start, it's off screen here, I'm going to bring it on the screen.

And you'll see that we have exactly what we should expect.

Now, I know there's some y'all out there probably going Wait a second jabril.

That is not what I expect.

There are two spaces in between the Z's.

And let's just pause here for a second and really examine the logic of our program.

So the reason that we're getting two lines in between a B and A when you probably expect no no lines in between them, is because the function right line itself, it does a new line for us.

So it prints out z equals z will print out z, and they'll go to a new line, and then I'll print out a new line and then go to a new line and then print out z, then go to new line.

And I'm going to just run that one more time.

Just confirm that's what happens prints out a goes to new line prints out new line goes the new line, then prints out z and goes to new line word ends there.

So it's doing exactly as as you as we want it to do.

It just looks a little weird in this context, because the right line function adds a new line without really telling us it Yeah.

Alright, so now with that out of the way, let's check out our escape characters in Python over here on the left, I was going to change our B variable to be single quotes.

I'm just gonna use single quotes because it's easier convention between the two, and we're going to do a new line.

And I have that backwards supposed to do backslash.

And you can see in Visual Studio code, it'll actually slightly tint the escape characters yellow for you to help you give a little more assistance, which is nice.

Visual Studio regular doesn't want to do that, anyhow, new line, and then we're going to print out a and then we're going to print out B, and then I'm going to copy and paste one more a.

And then let's run this by hitting the play button.

And you'll see that we have the same exact result that we have in C sharp and you already know why there are two lines there.

Moving right along, let's take a look at concatenating characters concatenating, it just simply means taking a few different things and putting them together.

So if you have three different characters, for example, you can concatenate them, and they become one word or one phrase, what have you.

That's all to concatenate means so to concatenate characters, you would think it would be as easy as you know, a new character c equals a plus a.

But it's not that simple.

In C sharp, when you add two characters together, the character data type takes the addition operator in turns the characters into intz.

In fact, every single character under the hood actually has an integer value assigned to it.

And we take a look at this chart here, which is this is the ASCII chart part of Unicode, you can see that every single character has some sort of decimal value assigned to it.

So we could take the character two, for example, and do two plus two.

And that will get us 100, which is a lowercase D character.

But just know There aren't too many use cases, for operations like that, just know that this is how it works under the hood, it's interesting stuff to know.

But let's move on.

So what you want to do is you actually want to turn your characters into a stream, just like that, and then you'll get an error.

Because again, when you use the addition operator on characters, they get turned ence and you're trying to assign an integer to a string.

So way to override that is simply just right to double quotes, and then just plus to it, it's like a shortcut to quickly convert whatever the assignment is to a string.

The assignment, again, is everything that's on the right side of the variable.

And so now we can just add all of our characters, the string C.

And so I'm just going to do a plus b plus a, which is z plus new line plus C.

And then I can delete two of these right lines.

And then I'm going to add c instead of a, and then I'm gonna hit play.

Don't bring this over.

And you can see here that it's a bit different now.

Now, why is that? Well, let's take a look.

Again, right line, every time you call this function, it will return to a new line, however, we use a string and only one write line.

So there are no new breaks other than the one that we coated in.

So it's literally does print z, go to new line, and then print another z, as you see here, print z go to new line, then print z.

So that's what's going on there.

Everything with programming, it's always really basic logic that you have to follow.

And, yeah, now in Python, because Python is an interpreted language, it makes doing stuff like this really easy.

All we have to do really is just do c equals, then we can do a plus b plus a simple as that, come down to our prints, we don't need two of them.

So I'll delete two of them.

And instead replace a with C, and then save that hit the play button in the corner.

And you can see that we have the same exact result.

It prints out an A goes to new line, I'm sorry, it prints out a z goes to new line, and then prints to another z, as you see here.

Simple, easy.

God bless Python.

So that's pretty much all that's to concatenating characters.

Let's now take a look finally, at the remainder of the most important escape characters.

So your you know backslash in or the new line escape character.

There's another pretty important one that you should know as well.

And that is backslash, R.

This is the return character.

So what the return character does, it returns back to the beginning of the line.

Now, back in the old days, this was really important to us, because you would go to a new line, but it wouldn't return back to the beginning.

Just wherever you left off in the previous sentence, it would just go to new line at that same exact spot.

So you had to call the return escape characters to make it go back to the beginning of the line.

So what happens if we were to run this in the console? Let's hit start the play button.

I'm going to bring it over and you'll see that we just have one character.

And that z.

Even though we have z return z, what's happening is that it's printing out z within, it's going back to the beginning of the line and printing z again.

And just to prove this, we can change this to why.

And then just just for extra proof, we can change, we can add a plus u, and hit start play button.

And you'll see what happens is it prints out z, but then the return character returns to x and get in line, and then it prints out a y.

And then it prints out a you essentially overriding our first character, which is z.

Now in the new modern age, you're not really going to use the return character too much.

However, I bring it up because it is good to know there might be some scenarios in which you might be using an older terminal or, or an older engine or something like that.

And you're losing your mind that you're using the new line escape character, but it's not returning to the beginning sentence.

Here, this is the return character use that it will all your problems will disappear.

Furthermore, in most new modern programs in terminals, next y&z the new line is actually it actually looks like this, and also looks like new line and then return.

And we can demonstrate that, interestingly enough, if we come over to Python and replace the new line shape character with a returning escape character, hit save, then play, you'll see that what we get is not what we expect, it actually is a new line, instead of a return.

And the reason for this is because what we're using to interpret the code is something called code runner.

And the way that code runner interprets a return escape character is likely like this, I can't verify it.

But this is likely how it interprets just a regular return character, thus, while we have a new line and a return.

And furthermore, if you really want to see the difference between code runner and you know, the terminal PowerShell that ships with Microsoft Windows, you can hit right click on the name of the Python script reveal in Explorer, and then just double click on this to run the Python script.

Oh, wait, I'm sorry, we have to add input here.

input, we'll keep the term open, double click on the Python script.

And there you have it, we have exactly what we expect.

That is just the difference between two different terminals interpreting interp breading sorry, code.

Okay, I hope that wasn't too confusing.

Again, you won't really have to worry about, you know, using characters in this manner.

Oftentimes, most people don't even you interface with characters this low level, but it is good stuff to know when you're dealing with strings all the time.

And yeah, let's move along.

The next escape character is backslash t, which is a tab character.

I'm going to turn this back into our simple, simple string.

And then I'm going to hit the start button and bring the console over and you can see that is z, tab z.

Simple as that Python, it's the same, just do a backslash T.

And we hit the play button, you see that z, tab z? Easy.

So the next escape characters we're gonna look at are the, quote, escape characters.

So at some point, you might want to add the character single quote, or something like that.

And you go to do that you're like, Okay, cool, single quote.

Wait a second, that how do I do that? Well, of course, simply put, just add the escape character, backslash, and then single quote.

So this right here, these two pieces, the backslash, and the single quote is the single quote, escape character.

And of course, you can do the same thing with that four string.

So let's say you want to write out some code or something, you can do backslash, and then a double quote.

And that is the double, quote, escape character.

So now if we just run this program, hit the start button, you can see that we get some really weird string with the double quotes.

The single quote z is just a demonstration to show you how you can use quotes if you really need to.

And now in Python, it's actually a little bit different.

So we can still do the same.

Use the backslash, whoa, I'm going to replace that backslash and then single quote, to get our escape character single quote, for example, you can hit play.

Oh, and saying sorry, running.

Oh, of course, I have to stop code on right click on the output, and then do stop.

Code run if you have input, just a quick caveat, because you won't be able to hit that play button anymore.

But I'm gonna hit play.

And you'll see that we have our sin called escape character, I replace with double quote, same deal, right, hit the play, you see that? Oh, wait, I have to save it, sorry.

And then hit play.

And you'll see they have a double quote, no big deal, right? Now, how Python is a little more special a little different is that we can use either single quotes or double quotes for a character literal.

So we can, you know, if we want to use a double quote, we just use single quotes on the outside.

And then I'm gonna save that and hit play.

And it's the same exact thing.

But if only is the same, quote, I can change the outside quotes to be double quotes, like so.

And just put a single quote in the middle, and then save that hit play.

And you see that we have a single quote in the middle of twosies.

So that's another benefit to an interpreted language.

It might save you a bit of time there.

But it's just yeah, it is what it is.

And the last important escape character is actually the backslash itself.

At this point, you already know where I'm going with this.

But if you want to write a backslash escape character, you have to do backslash to escape out, and then another backslash.

So two backslashes will get you one.

And just to prove that, I'm gonna remove this right there, and then I'm gonna hit the start button, bring this over, and voila, z, backslash, z.

And over in Python, it's the same exact thing, you just have to do backslash to escape out, and then another backslash.

And I'm just gonna save it play.

Come on, down.

And there you go, z, backslash, z.

And there you have it, guys.

That's pretty much everything you need to know to get started with programming in terms of characters.

Let's talk about floats, floats sent for floating point values, or floating point numbers, both are pretty much the same thing in which you could think as numbers or values that float somewhere in between integers.

So if both one and two are integers, with two coming right after one, then a float makes up all the numbers in between one and two 1.1 1.2 1.3 1.4 1.5 all the way to 1.9.

But make no mistake about it floats aren't limited to just one decimal place value.

Pi, for instance, is a float, it's most commonly represented as 3.14.

But we have no idea how many actual decimal points pi has, as it stands, researchers have calculated the two quadrillion digit for pie, and are still researching how to calculate even more digits.

So in short, the floating point values in between two integers are infinite.

And that is pretty much the basic two floats, they can honestly take a little work to understand them in their entirety.

But for now, all you need to know is that they are values in between integers.

So now let's take a look at a few examples on how to use floats with code.

And we're going to do this by using two different languages because I think it can be really helpful to see how they compare and contrast.

And plus, you will pretty much learn two languages at once.

So on the left is the language C sharp using the ID Visual Studio, which should interest you if you want to do windows development, or if you want to make games using a popular game engine called unity.

And on the right is language Python three using the Add Visual Studio code, which should interest you if you want to get into more general programming or data science.

Alright, so here I have two brand new console projects.

And if you don't know how to make a new console project, neither C sharp or Python, or both, be sure to check out the video in the description.

It's called How to install an ID.

And at the end of that video, I'll show you how to do that.

Alright, so the first thing I want to get into floats is the different operators.

If you're familiar at all with the operators, the integers use, then you'll be quite familiar with the operators that floats use as well.

Why? Because they are the same exact operators.

So jumping right into it in C sharp here on the left, I'm just going to get rid of these two lines that don't need them anymore.

They come standard with every single new console project.

And I'm just gonna initialize a float.

So I'm gonna type out float.

And then I'm gonna call it a just for an example.

And I'm assign zero to it.

Actually, that's no fun because zero is integer.

So let's assign, let's assign 7.77.

That sounds fun.

Now actually, before we get into talking about operators, let's touch a bit on the syntax between Python and C sharp.

There's not really much to the differences between the syntax of floats.

However, in C sharp you do have to clarify that your numeric value is a float by adding an F at the end of the numeric value.

This is just further instructions to tell the compiler on how they should go about handling this numeric value.

Simply meaning when your code is turned into instructions for a computer to do, when it gets to this line right here, it reads the flow.

And it knows without any confusion that this is a floating point value.

However, there is a caveat.

Even though this variable A is a float variable, you don't always have to add the float to the end of your values.

For example, if you instead just say float a is an integer seven floats automatically can convert themselves from integers to floats, therefore, you don't have to add the F.

Now while in C sharp, you have to add the F at the end of floating point values.

In Python, you don't have to do that, all you have to do is just type out whatever value that you want to do 7.77.

And Python will take care of the rest for you.

And Python is able to do this because it's a type of language called an interpreted language, where all you have to do is assign a value to a variable.

And it will interpret what data type that variable should have, which in a lot of cases is pretty nice, because you don't have to worry about the differences between floating point values are integers, you can just do sums and multiplication division, and not have to worry about any of that stuff.

But now let's get into some operators starting with the increment operator.

So an increment operator does exactly what it describes it increments and the syntax for that goes like this, a plus plus, that's it.

If we were to come down here and do a console dot write line, that just will print to the console for us.

And then we also need to console dot read key for C sharp so that the console doesn't close on us.

And I'm gonna hit the start button and bring the console window over, you can see that it just increments it by one plus one to 7.77 gives us 8.77.

And that is the increment operator.

Now in my experiences, it's not like a terribly good, handy tool.

But it can save you some times oftentimes, if you just want to add one to something, instead of having to do like full out.

Other operators need to do you know the variable plus plus and you're done.

And to do the increment operator in Python, you actually can't do an increment operator in Python, if we were to type out a plus plus, you can see that our ID shows that it's red to let us know that this is not a thing in Python, every language is different.

And Python just doesn't care about the increment operator, I guess.

So now imagine that you want to add more than one to your float? How would you go about doing that? Well, that is where our next operator, the addition operator comes into play the syntax for the addition operator goes like so.

So you want to do a or your variable, your float plus equals and then whatever value so we can do plus equals one to do another way to do an increment operator.

Or we can pass in a flow we can do, for example 3.33, F, and again, I added an F to the end of this value because it is a floating point value.

And if we were to run this hit the start button, bring the window over, you can see that we got 11.1.

Now just the minor note just to make sure we're covering all bases, you can see that it does not pronounce 11.1 F.

And the reason for that is because the F is something that only the computer needs.

Once the computer sees the code reads to F and sees that it's a floating point value, there's no point to return that back to us because we're humans, and we're smart.

And we know the difference between a float.

And just by looking at it moving a long to use the addition operator in Python, it's absolutely no different syntax wise, you do your variable in our case, a plus equals 3.33.

And again, we don't need add f because it's Python in Python doesn't care about F's far to come down here and write print a and then save it and hit the play button you can see down here that we will get 11.1.

And as far as adding is concerned, the final way that you can add value to your float is by doing something that I like to call a modified assignment.

Now this isn't a technical term.

I'm not sure if it has one or not.

But I like to distinguish this from regular assignments.

So what we're going to do is just get rid of all this just to clear up confusion.

And then we can do a equals a plus 3.33 F.

And there you have a modified assignment.

Now Whoa, what's going on here looks a little bit confusing.

Well, don't worry, let me walk you through it.

First thing you need to know is that this is the assignment operator.

And everything that is on the right side of an assignment operator is calculated first.

So the whatever the state of A is, which in this case is 7.77 is going to be added to 3.33.

And once that result is calculated, then it's going to throw that result to the left side of the assignment which is again In a sauna, since we're assigning a to equal what it currently equals, plus some extra value, we're just updating it really just a few different ways to do the same thing.

But you, as a developer have the choice to go with whatever best fits your programming styles.

And just to prove to you that this is the exact same result on hit the start button, bring the window over, you can see that again, we have 11.1.

And over in Python to do a modified assignment is the same exact syntax.

So I'm going to remove this lines to clear confusion start over and we can do a equals itself, plus 3.33.

And just to prove to you it's the same exact result, I made the play button, you can see boom, another 11.1.

Next up, we have a few operators for subtracting.

And the first one is the decrement.

operator.

Well, you already know what the increment operator does.

So guessing what the decrement operator does should be a no brainer.

Yes, you guessed it is simply just minuses one from your float.

And just like the increment operator is plus plus, well, the decrement operator is minus minus, that's all there is to it.

And to prove to you that it does what I say it does, I'm going to hit the start button, bring the wind over.

And you can see, we have 6.77, because 7.77 minus one is, of course 6.77.

And again, from my experience is not the most helpful operator out there, it can help you save some time writing code here and there.

But it is what it is.

And also again in Python, just as they don't have the increment operator, well, they also don't have the decrement operator, I can type out a minus minus and you can see turns red, then it's know that this is not a thing in this language.

And so if you want to subtract more than one from your float, you can use what's called the subtraction operator.

And the syntax for that is probably just as you expect, minus equals and then your float value, or your integer value, whatever numeric value, and just to prove to omit the Start button and bring the window over.

And as you can see, 7.77 minus 3.33 equals 4.44.

And over in Python, the subtraction operator is the same exact syntax, we're going to get rid of this start over a minus equals and then your value.

And just to prove that to you met the play button, and you can see that we have 4.43999999.

Now some of you are probably going what's up this discrepancy, C sharp said 4.44.

But Python says 4.43999 bla bla bla bla, well, I'm just going to give it to straight floating point values is something made by the devil, it's important to remember that floating points are the values in between integers.

And that space in between any two integers is infinite, and anything dealing with infinity.

But long story short, if you're just starting out, you don't have to concern yourself with things like this at the moment, at some point in time, perhaps he might dig into some project that requires like really precise floating point precision.

And at that point, you can pull your hair out.

But for now, just know the reason why you're seeing this is because in C sharp floats around to nearest digit, there are more accurate data types.

But that's beyond the scope for this, this course.

And for almost all your applications, two to three point floating precision is oftentimes good enough, you don't need to worry yourself with this kind of accuracy.

It's part of the reason why we have calculated about I think the quadrillion digit of pi, but we often just round it off to 3.14.

Because oftentimes, that's a good enough precision estimate.

Moving on, the final way that we can subtract is of course, by using a modified assignment.

And to do a modified assignment for subtracting all we do is get rid of this and we do a equals itself minus 3.33 F.

And just to prove to you that works, just as I say it does, I'm hit the play button, bring it over, and you can see that we have 4.44.

And over in Python, the syntax is no different than C sharp, we can do a equals itself minus 3.33.

I'm gonna save hit the play button, and you can see that we got 4.43999.

Next up the multiplication operator, whenever you want to do multiplication to your floats, you simply just have to use the multiplication operator.

And the syntax for that goes like this A times equals two, for example, and when you run this, it's simply just going to take your float a and times it by two and prove that to you.

I'm at the start button and bring the window over you can see that 7.77 times two equals 15 point 54 and of course what you times your float by doesn't have to be an integer, it can be a floating point.

But of course it just has to be some numeric value.

And over in Python, the syntax is the same exact as it is in C sharp A times equals to prove that to you hit the play button, and you see that we have 15 point 54.

And of course, another way we can do multiplication is if we do a modified assignment and the syntax for that, of course, you already know it is a equals a times to prove that to you, I hit the start button and bring the wind over.

And again, we have 15 point 54.

And in Python, the syntax is no different.

We can do a equals a times two, and then press play and show it to you that again, we have 15 point 54.

Now one thing that you didn't see me do is like something like a times times, and the reason for that is unlike subtraction or addition, there is no sort of incrementing multiplication.

What does that even mean, really.

And so moving on, the final operator is the division operator, which the syntax for that goes as follows a divided by equals to Alice make an interesting, let's say, 2.15.

And of course, what this is going to do is going to take our a float, and it's going to divide it by 2.15.

and prove that to you, I'm gonna hit the start button and bring the window over a, we see that we have 3.613953, that's gonna be fun to say over and over.

And over in Python, the division operator is the same exact syntax.

So we can do a divided by equals 2.15.

And to prove that to you, I'm gonna hit the play button.

And you can see that Python is a lot worse, we have 3.613953.

And it goes on and on.

I know that I'm kind of demonizing the long decimal points with Python, but it's actually a good thing that they give you this precision right out the box.

And the final way we can divide is by using a modified assignment, which the syntax for that looks like this, I'm just gonna start over to make it a bit less confusing.

A equals A divided by 2.15, F.

And just to prove that to you, I'm at the start button and bring the window over, you can see again, we have 3.613953.

And yeah, there you have it.

floats are pretty useful in the world of programming.

They're used for a lot of different applications.

And don't let me scare you with the whole floating point precision talk.

It's very, very rare that you'll have to be in this world floating points.

Usually, you won't go no further than like two or three point precision, which at that precision, everything's really simple to understand.

But that's pretty much everything you need to know to get started with programming in regards to floats.

It's time to talk about arrays.

Now, arrays are most often used with loops, but they can use in almost any context.

So what is an array? Well, you can think of an array as essentially a container that holds a fixed number of variables that all have the same data type.

So the fact that they're just containers that hold variables, you can use these variables independently.

in any context.

Say you want to update an array full of names with a couple of lines of code, or maybe easily save an array of 100 emails to a file without having to copy and paste and change the variable here and there.

Well, arrays make doing things like this really easy to do.

But instead of going on and on with examples about how arrays are the coolest thing since sliced bread, let's just jump right into looking at a few examples and use cases to learn how do we go about using arrays with code.

And we're going to do this using two different languages because I think it can be really helpful for you to see how they compare and contrast.

And plus, you'll pretty much learn two languages at once.

So on the left is language C sharp using the it Visual Studio, which should interest you if you want to into Windows development, or make games using a popular game engine called unity.

And on the right is the language Python three using the it Visual Studio code, which should interest you you're going into more general programming or data science.

Alright, so here I have two brand new console projects.

And if you don't how to make a new console project, neither C sharp or Python or both, be sure to check out the video in the description.

It's called How to install an ID.

And at the end of that video, I'll show you how to do that.

Alright, so let's get a bit into arrays.

So arrays are simply just a data structure, meaning it's a certain way in which you can structure your different data types.

So I won't get into too much in how to use arrays.

Otherwise, this video returns just like a long list of examples.

But let's jump into this.

So the first thing I want to touch on is the different syntax for arrays in both C sharp and Python.

But before we do that, I want you to imagine that you're making some sort of four player game, let's say and every single player starts with the same amount of HP.

So let's create those variables first over here in the lesson C sharp and get rid of these two lines.

Because I don't need them to come standard with every console project, and I'm going to initialize an integer, I'm gonna call it HP one, I'm assign that to be 100.

And then I'm gonna do it again, assign another, HP to equals 100.

And then int, HP three equals 100.

And then finally, ant HP four equals 100.

Great.

So we have four different integers for four different players.

But with the raise, there's no need for four different variables, we can simply come up here and initialize a new integer array.

And the syntax for that goes as follows.

First, we want to type out the data type that we want to put into an array, which of course, in our case, is an integer.

And if you want to denote that this is an array, you simply just add a start bracket.

And in bracket, this right here is how you denote an integer array data structure.

And so after that, we just type out our variable name, which I'm going to call it hp.

And then we have to assign to it a new integer array.

And then within the brackets here, you have to specifies the size of your array, which we have four players, so the size is four at a semi-colon, and you're done.

So now that we have our integer array with the size of four, we can now assign values to what's called the elements of that array.

And to do that, I'm just going to come down here, and I'm going to say HP, and then at the bring back the starting bracket and then typing the element number.

Again, it's the size of four.

So we're going to start with zero.

All right, so you probably just got a little confused on why I started on zero instead of one.

Well, in most programming languages, arrays always start on zero.

Why you ask? Well, zero is a number two and in computing, zero is actually the first number, not the biggest deal.

But a really simple fact that it's important to remember because if you start on one, you might get a lot of errors and might want to pull your hair out.

So just remember with arrays, zeros always first Anywho, we have the HP integer array at element zero.

And what we want to do is assign 100 to it.

And now we just want to do this for all four elements, I'm going to do HP of element one, assign another 100 to it, the HP of element two if I can type, and then assign 100 to it.

And then finally HP element three and assign 100.

to it.

Again, quick note, you can see that we ended on the element three, although we initialized an integer array with the size of four.

But if you were to count them, you can see that we have four elements here, 012, and three.

And of course, the reason for this offset is because in computing, we always start on zero, it can trip you up a lot at the beginning, but it's something that you'll get used to eventually.

Now I know if this is your first time learning about arrays, it can be quite difficult to get a conceptual grasp on what's going on here.

And so I'm going to walk you through a quick visual.

So what we have here is an array with the length of 901234567 and eight, this bottom row right here is the index or the element.

They're both interchangeable.

But for this course, I'm going to be calling it the element and this top row is the value at that element.

And so if this were our HP integer array, it would end right here, right at the third element.

And after we initialize the integer array, it was filled with all zeros in the value spots.

And so what we did in the code is we simply went through and assigned 100 to every single element in that array.

And that conceptually is what's going on with the race.

And that's not just for integers, it's for every single type of array, if you have a string array, a float array, a character array, what have you.

Now with that out the way we no longer need these variables, we can delete those.

And then to prove to you that these work, as I say they do, I'm going to write a console dot write line.

So that we can print this to the console and I'll do HP zero, and then semi colon, I'm just going to hit Ctrl C Ctrl V copy paste a few times and simply just change elements zero to one, two, and three, we're also going to need a console dot read key.

This is so that the terminal doesn't close when we run it.

And now I'm just going to come up here to the start, hit the start button, and then bring the console window over to show you that we have four players with 100 Hp initialized.

Now last thing I want to mention on this is that if you try to assign a value to an element that is outside of the range for that array, then you will get an error and to demonstrate that if I come here and do HP of element four and assign 100 to it, hit the Save button then play and you can see that it gives us an exception Saying pretty much that we don't have an array of this size, therefore you can't assign to the fourth element.

So just be mindful of the size of your race.

Now over in Python, the syntax for arrays are a bit different.

And Python actually doesn't even use arrays, they actually use a type of data structure called a list.

And you can initialize a list in Python in two different ways.

But the syntax for the first one goes as follows.

First, we're going to write out the name of our variable, which of course is HP, and then we're going to do equal and then start bracket.

And then you just type out whatever values you want in here.

So again, we have a four player game with four different players with 100 hp each.

So I'm simply just going to write 104 times with a comma separating each of them.

And there you have it, that's done.

And then to prove it to you, I'm just going to write print and then pass in the whole array, HP, hit the play button, and you can see that it prints out an array with four elements.

As you can already see, Python has a huge leg up when it comes to doing this type of stuff.

In Python, we really wanted to do two lines of code in C sharp, we had to do what eight 910, about nine different lines of code.

Big difference.

And the reason for this you might ask is just the design philosophies with the languages.

Python is more designed to be really easy to use and do a lot of data stuff.

And C sharp was kind of piggybacked off of the C language.

So that did carry over a lot of stuff the C was already doing.

But yeah, you get to pick and choose, there are pros and cons with both of them.

So that was the first way that you can initialize a list in Python.

And here's the second way, I'm going to come down here and do HP equals empty array.

And then it's as easy as HP dot append, and then your new parentheses because it's a function.

And then you want to append whatever you want.

So I'll pin 200 for the first player, and then I'll append again, another 100 for the second player, HP dot a pin, the third player and at last HP dot append for the last player.

And just to prove to you that does exactly what I say it does, I'm going to do print, again, HP, come up here to the topic, the play button, and you can see that we print out 100 100 100 102 times now this function is one of the benefits to using lists over array is that you can initialize the empty list and just add to that list.

And C sharp has one too, but it's a bit beyond the scope for this video.

Okay, so let's now talk about the real thing that makes a race so powerful.

And that's array iteration.

Alright, so this is cool.

Now we have all of our player HP in one variable.

But what if instead of four players with hp, you had 100 players with hp, this would get old quick haven't read this out 100 times.

Well, that is where four loops come into play.

Now, arrays and for loops are like burgers and fries, they're just a perfect combo.

So now let's bring in a for loop so that we can easily assign a value to the elements in our array.

So I'm just going to come up here above our variables here.

And I'm just going to write out the for loop syntax.

So for and then int i equals zero, and then semi colon, and then if i is less than we have four elements, so four, and then we're going to do i plus plus if that is true, and then we need to add our code block here.

And then we simply just need to write our variable.

And two here, so I'm not going to go too much into the for loop on how it works, because I have a full episode about that.

So check that out if you're confused, but essentially, on a very layman's level, the for loop, it's simply just assigns zero to our integer here, and then if it's less than four, then we're just going to add to it every single update.

And we can then use the eye as a location within the for loop.

And so with that, if this four loop is less than four, then they will increment meaning it's going to stop at three, which is exactly what we need, because our element also stops at three.

And so what that means is that now we can change this zero element two I element, and we no longer need these because they will be set with the for loop.

In addition to that, because we're also using the array element for printing.

We could even come down here and do console dot write line, and then HP of I elements, meaning we no longer need these lines either.

And so now just the proof to this works.

I'm hit the start button, and then I'm going to bring the window over you can see that we have four For 100.

So now back to the scenario I set up, say instead of four players you wanted 100, well, we simply will come to our array size here.

And we'll change the array size to 100.

And we also need to change the iteration for our for loop, one to stop at 100.

And to prove that to you, I can just hit the play button, and then bring the wind over here and there is 100 100.

It's a bit hard to tell.

But there's, there's 100, hundreds here and over in Python.

Again, the syntax for this is a bit different.

So I'm just going to get rid of these lines, because let's just start over.

But again, we do have two ways we can go about doing this.

And the first way is really, really simple.

All you got to do is do HP and then assign a an array of 100, but times that by 100.

and prove that to you, I'm gonna do print HP, and then hit the play button.

And you can see that we have 100 A hundreds in an array.

Simple, easy into the point God love Python.

And for the second way, it's a bit more involved, um, come down here and initialize an empty array.

And then we're gonna do a for loop.

The syntax is a bit different in Python, for i in range of 100, and then oops, and then I'm going to come down here.

And because it's an empty, I said empty array, but it's actually empty list, we're not going to get like the element of anything, we're simply just going to do HP dot append, and 100.

So then down here, all you got to do is print hp.

And we should get two arrays of 100.

Hundreds, which probably is going to be a bit confusing, but let's do it anyway, hit play.

And yeah, there is the second one.

And there's the first one completely identical.

Two ways to go about doing it, you as developer, you have the choice on which one you want to use.

And so yeah, that's pretty much the basics, all you need to know to go about using this data structure.

Anything from this point on would just be me listening out a million different examples on, you know, different use cases.

But if pretty much from this point on, it's up to you, as a developer to get creative and apply this data structure in different ways.

And hopefully, you are starting to think of some different creative ways on how you might be able to use arrays or arrays and for loops together.

But that is everything that you need to know to get started with programming in regards to a race.

Okay, let's talk about the big bad variables without even talking about programming.

What does variable mean variable defined by dictionary calm is something that has the ability to vary or change him believe it or not, it means the same exact thing in programming as well.

A variable is something used to store data, you can think of it as a container, but what you put in this container can be changed and updated, giving it the name variable.

Now there is one very important thing that requires understanding when talking about variables.

And that is data types.

If you can grasp this thing about variables, I think you'll save yourself a log of annoying errors, especially in the beginning, when you create a variable.

all languages need to know the data type of your variable and to again, thinking about a variable as a container.

Imagine that we have two data types that we want to store into a container.

Let's just say one data type is reptiles and the others fish, well, you can't store these two data types in the same container fish need to be surrounded by water in order to breathe.

And reptiles need land in often hot, dry climate in order to stay comfortable and alive.

So what happens if you drop a reptile into a containment for fish? That's right, you'll get a type error, just as if you create a variable meant for billions and try and assign a string to it.

So how do we actually go about using variables with the different data types and etc? Well, it's quite simple actually, let's take a look at some examples using two different languages because I think it can be really helpful for you to see how they compare and contrast.

And plus, you'll pretty much learn two languages at once.

So on the left is language C sharp using it Visual Studio, which should interest you if you want to do windows development or want to make games using a popular game engine called unity.

And on the right is language Python three using the Add Visual Studio code which interests you if you want to get into more general programming or data science.

Alright, so here I have two brand new console projects.

And if you don't how to make a new console project and either C sharp or Python or both.

Be sure to check out the video in the description.

It's called How to install an ID.

And at the end of that video, I'll show you how to do that.

Alright, let's start off by looking at initializing some variables and the syntax of that between C sharp and Python.

So over here on the left and C sharp I'm going to start by getting rid of these two lines because I don't need them.

They come standard with it.

The new console project.

And now let's take a look at the five main data types.

First, we have bullions.

And you can initialize a Boolean, like so, just type out the word bool.

And then whatever name for your variable.

In this case, we'll just do a.

And now let's initialize our next data type, which is a char.

So you do that by typing out the type of data, which again, is char, and the name your variable.

Let's just keep in alphabetical order going here, and I'll just name it B.

And now the char has been initialized, let's initialize our next data type, which is a string.

And we do that by typing out the type of data which is a string, and then keeping the alphabetical order, we'll just name it a C, I think you can get the pattern at this point, we're gonna initialize the next data type, which is an int, just type of the type of data and then name, the variable, we'll keep, we'll call it a D keep the order convention going.

Now, the last data type is a float, which we'll call an E.

And there you have it, initializing your variables in C sharp is pretty straightforward.

You just type out whatever type of data you want to initialize, and then name that variable.

And that's for all data types.

However, this isn't the only way that you can initialize variables, you can also assign something to those variables when you initialize them.

And to assign something to variables, you have to use what's called the assignment operator, which don't let that scare you, because it's as simply as just typing equals, equals here, this sign is what's called the assignment operator, it allows you to assign something to a variable.

And for this Boolean, let's just assign it to be true.

So let's go through and assign something to all of our variables.

So for our char variable, let's assign the letter J to it.

And then for our string, let's assign the string candy to it our integer, let's assign the number 13.

And then for our flow, let's assign a 7.77.

f, that's, that's a good number.

And there you have it, that is a another way that you can initialize a variable.

But heads up, it's always best practice to initialize your variables with an assignment like true j, for example, these are assignments.

And the reason for that is because like the previous example, if you initialize them without any assignments, sometimes they can return No.

And if you're using that variable, you might come up with some weird edge cases, and you'll get errors.

So it's always best practice to just assign a value to your variables whenever you initialize them.

Now to initialize variables in Python, it's a lot simpler with a slight caveat.

So Python does away with the idea of having to cast your variables.

So like over here, in C sharp, we have to cast that our a variable is a bool datatype cast that our B variables a char data type, typing the type of data next to it is what's called Data casting.

And then Python, you don't have to do that, all we have to do instead is simply type out the name of our variable and assign something to it.

So if we want to make a Boolean, we just assign a true value to it.

The Python language is a type of language classified as an interpreted language.

And what that means is Python interprets the data type of your variables depending on what you assigned to it.

So at the fact that we assigned a true value to the a variable, when you go to run your Python script, Python will know that the a variable has a boolean data type, because we assign a boolean value to it.

And this goes for all variables.

For example, if we just copy what we did in C sharp, b equals j, and C equals candy, and then d equals 13, and then equals 7.77, Python will interpret all of these variables into their appropriate data type.

And there are benefits to this.

And to examine that, let's go back to C sharp for a second.

Now at the fact that you have to explicitly cast your data type in C sharp, the moment that you initialize that variable, it is stuck with that data type.

For example, if I wanted to come down here, and let's say, I don't want a to be a char actually wants to be a bull.

Well, I couldn't do bool b equals true.

For example, it will tell us that this variable has already been defined.

So we can't recast data types of variables.

Well, can we just reassign the tab a different type of data? And the answer is no, it will tell you that you cannot convert it from its original data type to new data type is pretty much saying this variable already has a data type.

However, in Python, because it's an interpreted language, we can do whatever we want with our variables.

So for example, we can come down here and say like, I want B to equal true and it'll give you no error.

whatsoever.

And to prove this, I'm just going to write out a print function here, print a, whoops, A, B, C, D, E, and you will see that we will get two trues for a and b.

Let's save and hit the play button.

And Wallah.

Now, although this data type free syntax seems pretty cool and whatnot, and don't get me wrong, it is really cool.

It is a lot of flexibility, especially if you know how to use it, right.

But it can also cause some problems if you're not careful.

A lot of the common issues that I was finding myself in in the early days of learning Python with this data type free syntax was that I was never really sure what data type some variables were.

And I was trying to use them in certain contexts, and it was just really messing me up.

Another issue is that there's nothing preventing you from easily reassigning a variable, when you didn't mean to end C sharp, for example, they'll tell you if you already have a variable with that name in your script.

And it will also tell you for trying to change the data type for that variable, which both kind of act as a sort of security, if you will, but either way both have their own pros and cons, it's up to you decide which one is best for you moving along, one thing that I think is really important to touch on is assigning your variables after initialization.

So in C sharp, you only have to cast the data type of your variable one time.

In fact, you can only cast the data type of your variable one time to demonstrate this, I'm just going to get rid of this line because I don't need it.

And let's try and reinitialize our a variable as a bowl with a false value.

So I'm going to cast our data type, I'm gonna do bool, and then a equals false.

And you can see here that it tells us that this variable has already been initialized.

Essentially, that's what it's saying.

And of course, what you're assigning to that variable has to be a value that is accepted by that data type.

For example, Boolean only except true or false, for example, and of course, in Python, because it's an interpreted language, this is no problem, we can simply just do a equals false.

And we could also do b equals false if we wanted to C equals false.

And why stop there, we can do d equals false as well.

And we can even do c equals false.

Because this will all be interpreted when we run our script, which is now I made the play button up at the top and you'll see we get all false and a 777.

Because I didn't do II here sorry, equals false save, hit the play button.

And there you go all falses it was interpreted as soon as you run the script.

And so that is the gist of variables, they're really easy to get your mind around, it's just you have to remember that these are pretty much containers that have some sort of data in them with a specific data type.

So lastly, I'm just going to leave you with a simple example.

So that you can kind of get a better idea on how variables are applied and how they're useful.

So imagine you're making some sort of game with the boss battle.

And this boss can only take damage, when it's either hurt, flashing or dizzy.

It has to be in some sort of state.

So I'm just gonna create the scenario.

Remove all these lines, don't need them start over.

First initialize an int, I'm gonna call it enemy hp.

For example, that equals 50.

And then get a Boolean there recall this hurt.

And let's just say that it's already hurt.

So hurt equals true.

Get another Boolean, we'll call it a flashing, flashing equals true.

And then let's do ball.

dizzy, let's say dizzy.

And let's just say that it's not dizzy.

It's not really important.

I'm just gonna use if statements to create those states.

If hurt, then we're going to do enemy HP minus equals four, for example.

And then if I'm going off screen here, if I'm what else is there, flashing? Oops.

If it's flashing, then enemy HP minus equals four.

And lastly, sorry, see if what dizzy.

Then also enemy HP minus equals four.

Alright, so just to explain what's going on here.

It's just as I said, we have, let's say you're making some game with the boss battle.

And the only way that the boss can take damage as if it's either hurt, flashing, or dizzy.

Now, none of this is really important to the example that I wanted to create.

But it at least gives you an idea of a scenario.

So now imagine that you did some testing on your game and you figured out that for is not enough damage to make the game fun.

You need that damage to be higher.

Well, you would have to go back into your script and change enemy HP minus equals you know, let's just say seven enemy HP minus equals seven again In any HP minus equals seven.

And let's say that you had this reference to damage like all over your scripts, you have to do this as many times as you as you have that reference.

And this is a use case where variables are very useful.

So instead of having to do this, as many times as you make the reference in your script, you could simply just come up to your variables up here and just initialize let's say, a new integer, call it damage and set it to seven.

And then all you have to do is go throughout your script, and just add a reference to that the integer you just initialized.

So my sequel stat, whoops, damage, damage and damage.

So now let's say that you retested your game again, and you're like, Oh, wait, On second thought, seven is a bit too high, I need to bring it down a bit.

Well, instead of having to go again, through all of your scripts, and changing wherever you make a reference to HP minus damage, all you have to do is now change one variable to you know, a lower number, let's say six.

And now all of these references are updated.

And so now that your damage value is a variable, you now have a lot more power with it, you can come down, for example, so your dizzy state and say like, just for example, if he's dizzy, then what I want to do is damage equals three, for example, I want to make it a lot weaker if it's dizzy, and this will be updated whenever it's flashing, and you do this line, or you do this line.

And of course, I'll just quickly do this example in Python, it's going to get rid of everything, I don't need it.

I'm going to do enemy, HP enemy HP equals 50.

And then hertz equals true and flashing equals false and then dizzy.

equals false.

I got that backwards, this is actually true.

And then we have to do if hertz, then enemy, HP minus equals damage, I guess we need to damage them just go straight for the actual example minus equals six.

And then if, if what is it flashing, then enemy HP minus equals damage.

And if dizzy, whoops, dizzy, then damage equals three.

And why not just for fun, we can run this I'll do at the end of it all print and PHP, just see what we get.

I did not pre calculate this, we get 38.

Very nice.

And then if we print this in C sharp, we should get the same result.

I'm going to console dot write line.

And then what is this enemy hp.

And then oops, similar icon then we also need a console dot read line.

So the console doesn't close on us when we run it.

I'm at the start button up here and then bring the console over and you see that again, we have 38 Very nice.

And there you have it.

Again, variables are pretty easy to conceptually understand, but they get a lot more powerful and a bit more complex when you start using different data structures like arrays and whatnot.

But that's pretty much everything that you need to know to get started with programming and regards to variables.

Alright, so in if statement is a type of conditional statement in programming, meaning it checks if a certain condition is met an if statement in the most simplest terms is if this than that, in fact, if statements in programming are actually shorthand for If This Then That statements, one of the greatest lessons on fact that most people don't even realize with if statements is that if statements are essentially just bullions they activate if something is true, and don't if something is false.

Now remember that because understanding that fact can save you a lot of headache when trying to debug your if statements, you simply just have to look at your if statement and ask is this returning a true or false value? And honestly, it doesn't get any more complex than that.

If you've ever asked when an IF question, you understand if statements Now let's look at how to write an if statement with code.

And we're going to do this by using two different languages because I think it can be really helpful for you to see how they compare and contrast.

And plus, you'll pretty much learn two languages at once.

So on the left is the language C sharp using the it Visual Studio, which should interest you if you want to do windows development or want to make games using a popular game engine called unity.

And on the right is the language Python three using the IDA Visual Studio code which should interest you if you want to get more into general programming or data science.

Alright, so here I have two brand new console projects and if you don't have To make a new console project, neither C sharp or Python or both, be sure to check out the video in the description.

It's called How to install an ID.

And at the end of that video, I'll show you how to do that.

Alright, so today's lab is going to be really simple and really easy, because once I show you the Boolean secret with if statements, you're going to get it right away, and you're not gonna have any problems with if statements moving forward.

So just as I mentioned, the secret that most people don't even realize with if statements is that they're really just bullying that will run some code block if their value is true.

But before we dig into that, let's first look at some of the syntax differences between C sharp and Python.

Alright, so starting with C sharp over here on the left, I'm just gonna get rid of these two lines, because I do not need them, they come standard with any new console project.

And I'm going to write out an if statement.

And to do that in C sharp, first thing you need to do is just write out the word if, and then you want to add parentheses, and then inside these parentheses are where you want to put your Boolean, so I'm going to put true in C sharp, the true value is lowercase.

And then under it, I'm just going to write out a start brace.

And then in brace, this is the code block that will run if our if statement is true.

And there you have it.

This is how you write an if statement in C sharp From here, you can write any commands that you want in here.

So you can do like, I don't know console dot write line if you want to.

And then we can put Hi, for example, you can put whatever you want.

And so long as this returns true, this Boolean within the if statement in parentheses is true, then this block of code will be ran.

Now, before we move on to Python, I just want to mention one really important thing.

If statements in C sharp, they have to have the parentheses, and the Boolean has to go inside of the parentheses.

If you were to remove this, you can see that we will get a syntax error because if statements in C sharp again have to encompass the boolean value in parentheses.

Now over in Python, the way that the if statement works is the exact same however, the syntax is a bit different.

To write an if statement in Python, we want to first write out the word if, and then simply just put true.

And the true value in Python is capitalized.

So don't forget that.

And then at the end, we have to end it with the semi colon, I just want to pause here and make this distinction.

While Yes, Python doesn't use parentheses, it uses instead a colon.

And this colon is what tells Python that the Boolean for your if statement, it has been completed.

And so moving along to do the code block for your if statement in Python, it's a bit different than how C sharp does it again, the way that we indicate a code block in C sharp is we use the two braces starting in and we put all of our commands in the middle of those two braces, all which are under the if statement.

But in Python, instead, we have to go to the new line.

And we use indentations instead of braces.

So let's give an example.

and here we can just do like print.

And then Hi.

And there you have it.

And so the next natural question to ask is, well, how do I add more commands to my if statement? Well, the answer is pretty easy.

Actually, anything that is under the if statement and is indented in will count within that if statements code block.

So for example, I'm just going to hit Ctrl C Ctrl V, just to give you an example.

So here are four different print functions that are all within this if statements code block, because they all are indented in and they're all under this if statement.

And so the next natural question to ask is probably something like, Well, how do I exit this code block? I mean, I don't want my whole entire program to be dependent on this if statement.

And the answer is in Python, indentation rules over everything.

So for example, if you want to exit out of this code block, all you would have to do is just come down and then return back to the regular regular indentation, and just do print them out.

For example.

And just to prove to you that this works, as I say it does, I'm gonna hit the play button right here.

And you'll see that we get high high high amount.

And then I'm just going to set this to false to let you to let you see that we set this to false, this code block will not run, you weren't going to get printed, I'm out hit the play button.

And right there all we have is I'm out.

And another question you might have is well what about if statements within if statements like nesting if statements, I think in C sharp, it's pretty obvious how you do that you would just write in if another f within an F and do another code block and you can do another if you want to.

And this can go on forever and ever until you get tired.

But in Python, it's probably not as obvious for so I'll show you so you just right within That code block which again, is indented one indentation out, you just do another if statement.

True, for example, colon, and then just another indentation.

And you just keep this format going, as long as you need to.

And here we'll do another if statement.

Hmm.

Print another high.

And that's all there is to it.

And here's the very last thing that I'm going to leave you with.

So in C sharp, I'm just going to get rid of all this just so it's a lot less confusing.

In C sharp, when you have a code block, you can leave that code block empty, if you want, you have no errors, no problems.

C sharp won't complain, you'll be fine.

But in Python, you can't do that.

So if I remove all of these lines, and just have our if statement, and then we will return in the notation after the statement.

You can see if we go to our problems here, you see that we get an error for that.

This is not allowed, you have to put at least something in there.

So you know, if you just want to write some if statement, just to fill it out later.

For example, you can just put a if you want to, which does absolutely nothing.

And yeah, there you have it, guys, that's if statements for you.

I just want you to remember our little secret, the condition that if statements checks for they're only a Boolean, and again, the code block will run if the Boolean returns true, and it will not run if the Boolean returns false.

And so with that, you can create some pretty intricate and complex bullions and then just put that Boolean right here in the if condition from the most simplest program to the most complex program.

That is pretty much how every program works under the hood.

If you want to learn how to better use if statements I highly suggest you check out the Boolean lesson that I did in that lesson I go over more detail on how to use bullions in some real world situations and then once you create that Boolean you can just embed it in an if statement like this.

And yeah, that's pretty much everything you need to know to get started programming in regards to if statements.

So at the fact that you're watching a video on elf statements, I'm going to assume that you know what an if statement is, or in other words, If This Then That statement in disguise, but if statements alone are very limited, for example, say you build a robot to get lunch for you, and you tell it if they have spicy jackasses, Delia's Give me one your robot goes to get lunch, they don't have any spicy jack case to deal us.

And so it returns not giving you anything.

Now you can't get mad at your robot because it did exactly what you instructed it to do.

Very literally computers are very literal, but that is where an if statements partner in crime, the L statement comes in.

Let's start with what is an elf statement? Well, in the most layman's definition possible, an L statement is a conditional statement that will run if the initial condition is not met, and they're very important to programming.

Going back to our example, an L statement would be the equivalent to telling your robot if they are spicy jack case, and Delia's barmy one else give me anything, your robot again goes get lunch, they don't have any spicy jack case and dalias that initial condition is not met.

And so it gets you anything.

And honestly, elf statements don't get any more complex than that.

They are pretty simple concepts to get your mind around.

Now let's look at how to use the L statement properly with code.

And we're going to do this by using two different languages because I think it can be really helpful to see how they compare and contrast.

And plus, you'll pretty much learn two languages at once.

So on the left is the language C sharp using the ID Visual Studio, which should interest you if you want to do windows development or want to make games using a popular game engine called unity.

And on the right is the language Python three using the ID Visual Studio code which should interest you if you want to get into more general programming or data science.

Alright, so here I have two brand new console projects.

And if you don't how to make a new console project neither C sharp or Python or both.

Be sure to check out the video in the description.

It's called How to install an ID.

And at the end of that video, I'll show you how to do that.

Alright, so just like the if statement lab, this else lab is gonna be pretty quick and easy because there's not much to it.

So how do we use an L statement? Well, the first thing that's important to know is that l statements are completely useless without an if statement.

They are 100% dependent on an if statement.

To demonstrate this over on the left and C sharp, I'm just going to get rid of these two lines because I don't need them.

They come standard with every new console project.

And then I'm just gonna write out else and then our code blocks.

But you can see that we have an error, but syntactically we did everything right as far as syntax is concerned.

So what do we do wrong? Well, again, l statements by themselves are completely useless.

They need an F statement to depend upon.

So to fix this, I'm just gonna come above the else statement and write if and then let's actually do false and then our code blocks.

And then there you have it fixed.

As you can see, we're getting no errors, we have no issues, everything is fine and dandy.

So let me explain this relationship that we have going on here.

So you have your if statement right here, and this code block is only going to be ran if the Boolean inside the parentheses is true, but at the fact that it's we set it to false, it's going to go down and do this elf statement.

So in other words, if this statement is true, that means whatever is inside this parentheses, if this returns true, then run this block of code, else, run this block of code.

As simple as that.

And to demonstrate this, I'm going to write to the console.

So I want to use console dot write line.

And then here, I'm going to put a plan A, and then I'm going to come down here in the L OS, and then write console dot write line.

And I'm gonna do Plan B.

And then of course, I need to add a console dot read key, just so that the terminal doesn't close on us until we press a key.

Hmm.

And then just for demonstration purposes, I'm going to change this to be a true value, then I hit the start button up here, and bring the window over right here.

And you can see that it prints out a plan A, and again, very intuitive.

The reason is, because we said If true, which if this whatever is inside the parentheses is true, which we said is true, then it's going to print out this, and at the fact that it's true, it ignores everything after that.

Now, let's say that our if statement, Boolean returns a false value instead, well, remember the logic, this is checking if whatever's in this parentheses returns true, then run this code, else.

If it doesn't, then run this code.

And you can see that Visual Studio, the ID is giving us a little heads up that this is not going to be reachable, because it's kind of kind of put the alpha down a bit, it's a bit darker than the rest of the code, which is a nice little heads up from the ID and just demonstrate that this works.

Let me hit the start button and bring the console window over.

And you can see that it prints out plan B, just as we expect.

And now over in Python, the L statement works the exact same however, of course, the syntax is a bit different.

And just like the L statement in C sharp, we can't just write an L statement by itself in Python either.

So just for example, I'm gonna put a zero and then hit the play button.

And you can see that it returns a syntax error.

And again, the reason for this is that l statements need to depend on an if statement.

And so I'm just going to come above the O statement and then write an if statement, I'm going to say if false.

And then I'm going to print out what I'll just do one, yes.

And then you can see that I use the wrong false that is false for C sharps false in Python, and true in Python are both capitalized, trips me up all the time.

But there we fixed our l statement error.

And just to make this look just like the program that we did in C sharp, I'm gonna write Plan A here.

And then I'm gonna write Plan B there.

And again, you can use single or double quotes for Python, and doesn't really matter.

But just make it look cleaner, I'm gonna use double quotes for both.

And of course, if I change this to a true value, then it's going to give us plan A, when I hit play, Oh, I got of course do from print.

Plenty.

My mistake, let me just change this real quick print, Plan A, and then hit play.

And you see that we get Plan A and not Plan B.

And of course, if we change this back to false, and then hit save, and then hit the play button, you'll see that we get Plan B instead.

Because again, it checks if this statement is true.

Do this block of code.

Else do this block of code.

Simple as that.

And the final thing that I want to leave you with is that you can only have one l statement per if statement.

For example, if you come down here in C sharp and do if this statement, run this block of code else from this block of code, and then we chained to another else.

You can see instantly we get a syntax error.

Because even if you think about logic, this makes absolutely no sense.

You're saying if this is true, then run this is true.

Or else just run this and then or else run this that it just logically doesn't even make any sense.

So that's why you can't do it.

And of course in Python, we can't do two l statements back to back either was going to type l 's and then print plan.

gosh dang it, Plan C save hit run See that we get a syntax here because it makes absolutely no sense.

And yeah, there you have it.

l statements are pretty handy when paired with if statements and of course your if statements are just regular if statements in Jag bullions in there and make some really powerful logical operations.

And there is everything that you need to know to start programming in regards to L statements.

Alright, so you have if statements and you have Elif statements, but you also have else if statements.

So starting with the first obvious question, what is an else if statement, so you build a robot to get lunch for you, and you tell it if they have spicy jack case, and dalias Give me one else give me anything, your robot goes to get you lunch, they don't have any spicy jack case, Delia's and sort of returns with getting you a cheeseburger, but you realize that the restaurant doesn't serve french fries and now you wish that you had something different because what's a cheeseburger without fries and soda? Correct something like this.

You can bring in if statements other partner in crime the else if statement.

So how does it work? Going back to our example, using the elsif statement, you can tell your robot if they are spicy jackasses do is give me one else, if they serve french fries, give me a cheeseburger, else give me anything.

And with this program, you can send your robot to any restaurant and be sure it'll get you what you want if the conditions are right, because if statements are pretty much just bullions they're essentially like backup if statements.

And that's pretty much all this to an else if statement.

Now let's look at how to use elsif statements properly with code.

And we're going to do this by using two different languages.

Because I think it can be really helpful for you to see how they compare and contrast.

And plus, you'll pretty much learn two languages at once.

So on the left is language C sharp using it Visual Studio, which should interest you if you're in the windows development or want to make games using a popular game engine called unity.

And on the right is language Python three using the ID Visual Studio code which interests you if you want to get into more general programming or data science.

Alright, so here I have two brand new console projects.

And if you don't how to make a new console project and either C sharp or Python or both, be sure to check out the video in the description.

It's called How to install an ID.

And at the end of that video, I'll show you how to do that.

Alright, so just like the L slab, the elsif Lab is going to be pretty quick and easy.

Because again, there's not really too much to this.

So how do we use an else if statement? Well, just like an L statement, if elsif statement is completely dependent on an if statement without an if statement in elsif statement is just completely useless.

And to demonstrate this over here in the left in C sharp, I'm just going to remove these two lines because I don't need them, they come standard with any new console project.

And I'm just gonna write else.

And then if and then true, and then my code block.

And as you can see, we get an error because this is invalid syntax, again, elsif statements are completely useless without an if statement.

And over in Python, it's the same exact thing, except for the syntax for elsif statements, it's just a little different.

So instead of else if typing that out explicitly, you just type e L, i f, else if it's shorten, and then you can just put true here, and then your colon and then your logic.

But even if I were to put some logic here, let's just say I'm gonna put zero, you can see that we get an error, I'm going to hit play.

And it tells us that this is invalid syntax.

Again, the elsif statement by itself is completely useless.

And so to fix this, I'm just gonna come right above our elsif statement and add an if statement to that.

So if true, then we go on to do console dot write line.

And then we're going to say Plan A, and then I'm going to come down here and do the same console dot write line, and then plan spell Plan B, semi colon, who's going to do the same thing in Python so that they are on the same spot.

Let's see true, then we want to do print planning.

Remember, indentation is really important.

So we're going to come back down here.

And then it also if that's true, they want to print Plan B.

And so what is all this same? Well, this is saying if this statement is true, then run this block of code.

Else.

If this statement is not true, but this statement is true, then run this block of code.

And over in Python, it works the same exact way.

So we have if this statement is true, then run this block of code here.

Else if this statement is not true, but if this statement is true, then run this block of code, one difference on a point output To for the elsif statement, it's a minimal difference.

But Python really prides itself in being like optimized in every way possible.

And that includes like how many characters you have to type for elsif.

This is only four verses over in C sharp, you have to type seven, including the space.

Again, it's minimal, but differences or differences.

Now here is where the real power of elsif statements comes into play.

What makes elsif statement so useful is that you can add as many else if statements as you want, there are no limits.

So if I come over here, and just grab this, and then hit copy, and then paste and then paste, and then paste, you can see that we have no errors, there's no problems, no issues, you can do this as many times as you want.

In Python, there's no difference, you can grab this copy and paste for example.

And oops, and do this as many times as you want.

They'll do be careful with your indentation, make sure that your indentation is always correct.

And so with that, I think it's important to touch on the order of operation and how important that is.

So with any if statement tree, it always will first check the first one, if the first one is not true, then it'll go to the next one.

If the next one's not true, then it will go to the next one, it'll keep on going blonde down the line until it gets one that is true.

So say, for instance, this one is true, then it's going to run this block of code, and it's going to exit out, it's never going to even touch this elsif statement right there.

And I can demonstrate this for you.

I'll just change this to plan C plan changes a plan D changes, plan E.

And let's say that the Boolean check here returns a false.

And then let's say this one also returns a false, and so does this one right here? Well, what we should expect is that it's going to check this one, get a false elsif, check that one get a false L.

So check that one, get a false, Elsa, check this one and get a true, and then we'll run this block of code and should print out plan D.

And just to prove that I'm going to hit the start button.

And then I'm going to bring oops, we forgot to add a console.

Console dot read key so that the terminal doesn't close until we press a button.

And then I'm going to hit the start and then bring crossover and Wallah, we have plan D just as we expected.

Now, of course, this also works in Python, and I can prove that to you just going to change this to see the E did I mess up a B, C, D E is m a one over here, either way, e f, and then we can set this one to false.

And then we can set this to false.

And then we can set this to false.

And we should expect again to get to print out plan D going to hit the play button and we see a plan D.

And the last bit of information I think will be useful for you to know is how to incorporate the actual elf statement.

So let's say that you have some variable, right? You have like a money variable.

And you have this first statements like if I have over, I don't know $1,000, then do this block of code.

Else.

If I have over, let's say $750, then run this block code.

If I have over 500, run this one, if I have over 250 for example, run this one.

If I have over 100 then run this one.

And let's say that you have to print to the console something, right? Well, if you do all these checks, and you have $0 and you'll never print anything, but that's where the else statement comes back into play.

All you have to do at the very end of your if statement tree is just simply add else.

I want to do a console dot write line.

plan what is f Plan F and that is all you got to do.

Now take note your elf statement has to be at the end of your if statement tree.

It can't be anywhere else.

But at the very end.

I mean even if you think about it logically, that's the only thing that makes sense.

And that's pretty much everything else if statements.

The final thing maybe to note is that else if statements are no different than if statements like this, and this are the same exact thing.

The only difference is that an else if statement is dependent on an if statement.

You remember that simple rule and you'll have no trouble using elsif statements and that is everything that you need to get started programming in regards to else if statements.

For loops, it's time to learn all about for loops.

Now, these are a very essential thing for any programmer to know.

So what is a for loop? Well, simply put a for loop is a shortcut to run a block of code a certain number of times.

So say you have four phone numbers, for example, and you want to add an area code to each of them.

Well, instead of hard coding this four times phone number one plus equals area code, phone number two plus equals area code, phone number three plus equals area code, etc, etc, you can just use a for loop and write up the logic one time to get the same job done in less lines of code.

And for loops are very powerful in this regard, because they scale quite well.

So for phone numbers isn't that bad, you can write out phone number 1234 plus equals area code pretty quickly.

But now imagine, instead of four phone numbers shown at area code two, imagine that you had 4000 phone numbers, you can imagine how redundant it would be to have to write out phone number 1234567, all the way to 4000 plus equals area code 4000 times.

So let's take a look at how we can use for loops to do amazing things like this.

And we're going to do so by using two different languages because I think it can be really helpful for you to see how they compare and contrast.

And plus, you'll pretty much learn two languages at once.

So on the left is the language C sharp using the ID Visual Studio, which should interest you if you're interested in doing windows development or want to make games using a popular game engine called unity.

And on the right is the language Python three using the IDE, a Visual Studio code which should interest you if you want to get into more general programming or data science.

Alright, so here I have two brand new console projects.

And if you don't know how to make a new console, project new, the C sharp or Python or both, be sure to check out the video in the description.

It's called How to install an ID.

And at the end of that video, I'll show you how to do that.

Alright, so for loops, for loops are extremely useful tools in programming.

So let's jump into it starting with some syntax.

Now the syntax for for loops in C sharp can be a bit tricky to remember.

But it's not terribly hard, you only have to remember these three things.

But first, I'm going to remove these two lines because I don't need them that come standard with every new console project in C sharp, so we can just get rid of them.

And this is what you have to remember, I'm gonna write this in a comment just so that it's easier to remember.

So a couple forward slashes for that.

And so first you write the word for, and then parentheses.

And now in these parentheses, this for loop happens in three steps.

So let's segment in by adding two semi colons.

And that last, the first thing yet memorize is to initialize your variables variable.

I'll just shorten this to initialize because we were going to quickly run out of room.

And then the second thing you have to remember to do is to set your condition.

And the final thing you have to do is give a command.

So long as you remember, these three things for loops will be really easy for you to remember.

So now let's walk through an example on how to initialize a for loop for real, I'm just going to come down here to the next line, and I'm gonna write out the word for.

And then the first thing I need to do is initialize a variable.

Now, the most common variable that most people initialize at this step is actually an integer variable called I.

And you'll assign usually zero to it.

But you can assign whatever you want to it.

Actually, you can initialize any variable of any data type that you want here, but we'll come back to that in a bit.

And so the next thing we have to add here is the condition, which simply just asks, How long do we want this for loop to run.

And this condition here in this space is actually just expecting a Boolean.

And so let's write a Boolean in here.

Let's say that we want to run so long as is less than 10.

Sounds good enough to us.

And then the final thing we need to add is the command and what the command, we simply just instruct our computer to do something.

So if we initialize an integer named I and assign zero to it, and we're saying that we want this for loop to run so long as is less than 10.

Then here, we can say, We want i for every time the loop finishes to simply just add one, using the increment operator, it just adds one to whatever variable we added the increment operator to.

And then at last, we just come down here and add our code block for the for loop.

And now every single time that this loop goes through, it's going to run everything within the code blocks, which again is every thing that we add within these two braces, and then at the end of it is just going to come back to the top and then when it comes back to the top, it's simply going to check our condition here, it's going to ask is i less than 10? If true, then it's going to exit here.

It's no longer gonna run this this loop anymore and go to whatever line is right after that, but if false Then it's going to do our command here.

And then it's going to again, run this block of code and continue that until when it checks here, and this is false, then again, it's going to exit and run whatever line comes after the for loop.

And so now to do a for loop in Python, it's actually a lot different.

Python doesn't have this syntax where you initialize a variable, and then you set a condition and then you give a command.

It's actually, in fact, probably a lot more simpler.

But the syntax for it goes as follows.

First you want to type out the word for, and then you want to type out I, for i in and then you need to define a range.

And let's just say 10, we're gonna use the same 10.

And then you write your colon here to start your code block.

And then here, you can put whatever commands you want in there.

Now, that's how you initialize a for loop in both C sharp and Python.

However, I want to go back to the C sharp initialization real quick and point out something really interesting.

Now, I think in most cases, for for loops with this syntax, you'll find that most developers will first initialize an int called I, and then assign it to be zero and then do like, if and if i is less than a certain number, then we're just going to use the increment operator on it.

But I want to relinquish your mind early in development, because this right here is the actual rules for a for loop.

But to understand where I'm about to go, I think I need to first show you what's going on with a traditional for loops.

So I'm gonna do console dot write line here.

And I'm just going to print out the value of i.

And then of course, down here, I need to write a console dot read key, so that the terminal doesn't close on us.

As soon as we run it, I was gonna come up here, hit the start button.

And then I'm bringing the console window overseeing see we have going on here.

So as you see, I is initialized and assigned to zero, and then we increment increment all the way until I is no longer less than 10.

And then we exit out the for loop.

Pretty simple.

But again, here it says initialize.

So we can initialize whatever we want.

Actually, this doesn't have to be an end, we can initialize a float if you want to run it again.

And you can see that we have the same exact result.

But why stop there, instead of using the increment operator, we can do plus equals point five, we want to hit the start just to show would that result and you see that we zero then we increment plus five and then another plus five all the way to 9.5.

And of course, that's not all, we can initialize a string if we want to and assign that to equal empty string.

And then here our condition as long as I and then we can grab the length by hitting dot length of the string is less than 10.

Let's just say, then we want to do i plus equals, let's say z, for example.

And then we can run this for loop here.

Start button, bring the window over.

And we can see that it creates this interesting for loop, the sky's the limit, so long as you follow this convention right here.

And because Python doesn't have the syntax, you can still achieve it, but you'd have to achieve it in other creative ways.

Also, I didn't prove it to you that this works in Python.

So I'll do that really fast.

I'm gonna do print, and then I and then I will run this when the play button, you see that it prints out all the digits in the range of 10.

Now that's pretty much how you go about using for loops.

Now as far as how you go about applying for loops, that's your own creative problem solving endeavor that I'll let you figure out on your own.

However, I will leave you with one use case.

So I went ahead and wrote out the program for our scenario, because otherwise, it would have been a long silence watching me type this out.

But I'll walk you through it.

But first, imagine that you've collected 700 files with a bunch of candy data on it.

And now that you have this data, you need to get it all in one place.

Now you could open up one text file and manually add it to the other then open up another text file and manually added and the next and then add in next and add but that's even exhausting for me just saying it verbally, you could instead write a program with a for loop to do this for you.

And so first we initialize a few variables.

First one is a string array with all the file names on it.

And then the next we have the master data string, which we're going to compile all of our data to and over in Python and we do the same exact thing.

We initialize a string array called filename with 700 files that can fit on there, and then our master data string that will compile all of our data onto and then we come down to our for loop in which we initialize an integer named I assigned zero to it.

And then we have a condition here, which pretty much just says so long as I which is location in our for loop, as long as that is less than the amount of files that we have in the file name string array.

Then we want Want to continue looping.

And then of course, our command, we just want to increment the integer I, and then down here in the code block.

All of this is kind of fake, I just made it up for the scenario.

But there's a huge assumption happening here, I'm assuming that you as the data collector, you are really good at naming your data files.

And so every single data file that you have is named candy, space, data space, and then whatever number of data file that is dot txt, very important, because if your data files are named something a bit more chaotic, then we lose the power to use a for loop by and so let's just say that this is you're really good at naming your files like this.

Oh, and just to clarify, this dollar sign means that this string is interpolated.

This is an interpolated string.

If that's confusing, check out my string lesson, I go all in depth into it Anywho, what we're doing here is we are taking the file name array at the element of AI, which is where we're at in the loop.

And then we're just going to assign this file name to that location, or that element in the file name array.

And then on the next line, I made a fake function here, where it takes in the name of the file name, and it's supposed to read data.

But down here doesn't do anything, but just return.

So like some string with the actual data name, but this is a real function.

It exists in a lot of libraries.

But I it's beyond the scope of this video.

So just know that this, this, this right here represents something that really does happen.

And so we pass the file name to the read data function, the read data function will open up the text file rewear was on there.

And then we will add that to our master data string.

And then over in Python, we do the same exact thing.

We have a for loop here for i in range length of filename, just to break apart what this means really quick.

So length function, it returns a number of items in a container.

And so this file name is a list with 700 items in it.

So when we run length of filename, it's going to return 700.

So for i in range of 700, will be our for loop.

And then we come on down into our code block.

And here, again, we have our file naming convention that we're just going to assume that you're good at labeling data.

Every file is named Kenny data, and then whatever the number is, but it doesn't start at zero, it starts at one, so we have to add one to our I because I does start at zero dot txt.

And then we just assign that to our filename list at the element of AI, again, that lives from zero all the way to 700.

And this is going to match up because they're both using eyes here and here.

And then finally, we made a fake function called read data, it doesn't really do anything except for return Kenny data from and then whatever the name of the file is, but we will run that function pass in the file name.

And let's say this was a real world scenario, then this would open up whatever that txt file is grab the data from that.

And then we would add that to our master data string.

And then finally, we come down here, and then we'll print the master data.

And just to prove that these work, I'm going to come up here and hit the start button, C sharp, and bring the window over and you can see that we have all this candy data.

Look at all that candy data.

Wow.

Then I'm come up here in Python and hit the play button and error.

Oh, right, right.

So Visual Studio code has a really weird, well, it's not weird, it's helpful.

But if you have something selected and you hit the play button, then it's just going to run that.

So almost like nothing and then hit the play button.

And there you go.

You can see that a generates all that data.

Wow.

And yeah, there you have it.

This is one creative use case in which for loops can be really helpful.

But there are a ton of different for loop use cases.

But it would take me all day to sit here and list out a bunch of different ones, but you now know how to write your own four loops.

So now you can think of really interesting ways yourself to apply for loops.

And that is everything that you need to know to get started with programming in regards to for loops.

Let's talk about while loops.

while loops are a type of loop obviously, and they share a lot with a for loop except instead of running a block of code a number of times it runs a block of code while a certain condition is true, hence the name while loop you'll find that while loops are a lot less common for loops, but every once in a while you'll find the perfect use for a while loop.

So for for loops.

For instance, when I make any sort of robotics project I find while loops very handy to use anywho.

Let's take a look at how to use while loops with code.

And we're going to do this using two different languages because I think it can be really helpful for you to see how they compare and contrast and plus, you'll pretty much learn two different languages at once.

So on the left is language C sharp using the ID e Visual Studio which should interest you if you want to do windows development or want to make games using a popular game engine called unity and on the right is the English Python three using the ID Visual Studio code, which should interest you if you want to get more into general programming or data science.

Alright, so here I have two brand new console projects.

And if you don't know how to make a new console project, neither C sharp or Python or both, be sure to check out the video in the description.

It's called How to install an ID.

And at the end of that video, I'll show you how to do that.

Alright, so while loops, Now today's labs can be pretty short, because there's not really a lot to while loops.

But let's start by looking at the syntax for a while loop in C sharp over here on the left, I'm going to get rid of these two lines because I don't need them.

And they come standard with every new console project.

And I'm simply going to write out while and then in parentheses true.

And then our code block.

This is the syntax for a while loop in C sharp, you essentially just write while and then you have to pass in a Boolean here.

And then you ever code blocks and where you can put all of your demands that will continue running over and over and over.

While this Boolean is true.

And over in Python, a while loop looks like this while and then true.

And then I'm just going to put pass here in our code block past just pretty much means don't do anything.

And this is the syntax for a while loop in Python.

Pretty simple.

Now one extremely important thing that you need to know about while loops is that while a while loop is running, whatever comes after the while loop.

So if I come down here, for example, into a console, console dot write line, for example.

And then reach, for example, anything that comes after a while loop will not be reached until the while loop has been completed.

And again, the reason for this is because when you run a while loop, it just runs whatever the code is in its code blocks over and over and over however many lines there are, it goes one by one by one.

And then once it reaches the end, it starts over the top and continues going until this boolean value here is no longer true.

Once this is false, then it will stop doing this loop and then go to the next lines after the while loop.

And this process also happens in Python.

If I just come down here and do print and then reached, for example, this while loop will keep on doing every single line in this code block until this condition here is false.

And if it's never false, then guess what this code right here will never be reached.

And I can prove that.

But first I need to set up a couple of variables, I'm going to come up here and then I'm going to initialize an integer.

Let's just call it a why not, and also t equals zero.

And so within this boolean value, all we have to do is say if a is less than 100, then we want you to run and then every single time to run, we can simply just do a plus plus, use the increment operator.

And then let's also do a console dot write line.

And just just print out the actual integer value.

And so what's going to happen here is that when our main program is ran, it's going to go down the line and then hit our while loop.

And because A is less than 100, it's going to run this block of code one time, you know plus to a and then write it out.

And then it's going to reach the end and do it again.

And then again 100 times until a is no longer less than 100.

Once it's greater than 100 or equal to then this will no longer run and then they'll go to our right line reached right here.

And we can print it out.

And I can prove it to you.

But first I need come down here and do a console dot read key.

So the terminal doesn't close on us when we hit the start button up here.

And I'll bring the window over.

And as you can see, we get results that we expect to get the while loop will run over and over and over until it's Boolean condition is no longer true.

And once it's false, then finally the while loop will exit it goes to the next line.

And then on that that line after it we have the printout reached which there it is at the end of the while loop.

And over in Python.

This is done the same exact way just in the Python syntax.

So to set that up, I'm simply going to come up here.

Oops, what did I just do? Oops, I think I Yep, collapse that.

Okay, come up here I'm gonna do a equals zero.

And then while a is less than 100, and then instead of pass, we're gonna print just whatever A equals and so not approve that they work the same.

I'm hit the play button up here.

And as you can see, we have Oh, we forgot to increment, right? I'm simply going to increment a up here to a plus equals one.

And now our code should be fixed, I hit the play button, and bada boom, there you have it, same exact scenario as in C sharp.

And finally, there's one more way that you can go about stopping a while loop.

And that's by using the break statement.

So first question, what is the break statement? Well, the break statement is a statement that can only be used with loops, like for loops, and while loops.

And when you use the break statement, all it does is just breaks that loop moving on to the next line after the loop.

So to demonstrate this, I'm going to replace this Boolean right here with just a regular Boolean, true value.

And then I'm going to go into here and write an if statement.

So now I'm gonna say if a is greater than or equal to 100, then what we want to do is break.

And to prove this works, I'm coming here to the play button, hit start, and then bring the window over.

And you can see that it works exactly the same as the other method.

And to do this method in Python, I'm simply going to replace this Boolean with the true boolean value.

And then I'm going to come down here and do if A is, is greater than or equal to 100, oops, 100, then we want to break, gonna hit that play button up here to prove that it works.

And you see that we have the same exact thing, probably didn't even notice that it changed.

And that's why it was for you.

They can be handy in certain situations.

But to be honest, you will probably more often be using for loops.

And there you have it.

That is everything that you need to know to get started with programming in regards to while loops.

It's finally time to talk about methods.

So methods are amazing programming tools that simply put allow you to not have to repeat code over and over and over.

And to be able to get a better grasp on your code.

For instance, say you have some inventory class.

And in this inventory class, you have a few things that can happen, you can close the inventory, you can open the inventory, you can empty the inventory, just to give a few examples.

And instead of having to change a list of inventory variables, every time you want to do these things, you can just wrap all this code into a method and just call that method whenever you want to do it saving you a lot of time from writing the same code over and over and saving you from future headache.

So now let's take a look at how to use methods with code.

And we're going to do this using two different languages.

Because I think it can be really helpful for you to see how they compare and contrast.

And plus, you'll pretty much learn two languages at once.

And so on the left is language C sharp using the IDE, a Visual Studio, which should interest you if you want to do windows development or want to make games using a popular game engine called unity.

And on the right is the language Python three using the it Visual Studio code, which should interest you if you want to get into general programming or data science.

Alright, so here I have two brand new console projects.

And if you don't how to make a new console project and either C sharp or Python or both, be sure to check out the video in the description.

It's called How to install an ad.

And at the end of that video, I'll show you how to do that.

So before we can use methods, we first have to learn how to initialize them.

So let's take a look at their syntax first over on the left and C sharp, I'm just going to get rid of these two lines because I don't need them.

And then I'm going to come down here so that we can initialize a new method and the syntax for that goes as follows.

You simply just type out void, and then whatever name you want for your method, I'll just call it ABC, for example.

And then you need to put a start in parentheses.

And then finally, is simply just add a code block.

And now you can put whatever commands you want within this code block.

For example, I'm just going to put console dot write line, and pizza, because pizza is the best.

And there we have initialized a method.

Now to do this in Python, it's just a little different, but the concept is still the same.

So to initialize a method in Python, you want to type out instead of void, you want to type out def, def, and then whatever name for your method or isn't called again, ABC.

And then you're gonna do your start in parentheses, this convention stays the same.

But instead of going to a new line and doing code blocks using the braces, you simply just use a colon here, and then go to next line and make sure that it's indented.

I'm using the Visual Studio Code ID, which automatically adds an indent for me when I go to next line.

Well now just like in C sharp, I can add whatever commands I want in this code block.

So I'm going to write out prints.

And then again, pizza, because pizza is the best.

So that's how you initialize a method in most C sharp and Python.

But without more context, I don't think they're that helpful.

So let's take a step back and examine a scenario.

So imagine that you're writing some sort of program with an inventory system that has three spaces, and this program requires you to swap out what's in those three spaces quite a lot.

So just to make is less confusing, I'm going to get rid of our initial examples on both Python and C sharp.

And now I'm just going to pretty much set up that scenario with some variables.

So I went ahead and wrote the scenario off screen, because otherwise it probably would have been about five minutes of silence.

But I'll walk you through it.

So up here, we have all of our string variables.

This is our inventory standing for I envy slot, one, two, and three Python as the same.

And we first set them all to be empty.

And then we have a couple of items we can pick up under the variable name, pickup, one, two, the first one is pizza, because pizza is the best.

And then we have candy.

And of course, Python has the same exact thing going on there.

Next, we just have a couple of if statements to kind of simulate an event happening, let's say that you want to pick up some items.

Well, first, you want to check to see if it's empty.

And then if it's empty, then you pick it up.

Same thing happening here in Python.

Okay, so we have our scenario all set up, I'm just going to come down here and add a console dot write line, so we can print out the results here.

Let's print out first in Vin one.

And then I'm lazy, I'm just gonna do Ctrl C Ctrl, V, copy paste a couple more times, and print out also in Vin two and inven.

Three.

And I'm, of course, gonna come over here and Python do the same exact thing, except for the syntax a bit easier.

In Python, I can just do inven, one, there, and then comma, and one, two, and comma in vim three, a much more simplistic print function Python has now before we run it, what should we expect? Well, again, all of our inventory, slots, stuff is empty.

And then we come down here and do a check if the first slot is empty, then we're going to assign the pickup one to Inventory Slot one, which is pizza.

And then we do another check.

If Inventory Slot three is empty, then we'll assign the pickup to to it, which is candy.

So all we should expect is pizza, empty candy.

Let's see if we get that just gonna come up here and hit the start button.

Oh, that's going to close on us.

I forgot to add, of course, console dot read key.

Alright, so again, I'm just gonna come up here and hit the start button and bring the window over.

And you can see that we have an Inventory Slot one pizza, slot two empty and slot three candy.

Perfect.

Gonna run that in Python as well hit the play button up here.

And you see we got pizza, empty candy.

Perfect.

Okay, so this isn't bad.

This is pretty straightforward, does exactly what we want.

But now imagine this scenario where when you assign a new item in your inventory, it doesn't only just change that item slot.

Maybe also, you know, it does some UI stuff here.

And then it does like some special effects was that I'm saying v effects, and then maybe like updates, other like update.

slot one, for example, Inventory Slot one also updates inventory, slot two, slot two, for example.

And this does this happens for every time that you want to do this, right.

So I'm gonna copy this and bring this down here.

And you can see that our code is starting to get long and kind of strenuous.

Now, this is where one of the use cases for methods come back into play.

The first advantage to using methods is having the ability to compress your code.

Now, why would we want to do that? Well, everything within the code blocks have this main function right here is our main program.

And over in Python, just for comparison, every line in the script counts as your main program.

But as you add more code in the main program gets longer and longer, it can become more and more confusing and difficult to read and understand.

And so instead of having this chunk of code or this chunk of code, we can convert that into a method and just call that method in our main program.

And so let's do that.

And to do that, I'm first going to come over to our first chunk of code, and essentially encapsulated inside of a method.

So right above it, I'm going to add a start brace comes to the bottom of it at an end brace and Visual Studio automatically reformats to it for me, thank you Visual Studio, and then I can simply add our void.

And then we can now get to the hardest part in all of programming.

Now, we have to name our method, which thankfully, I thought of all this ahead of time, so you don't have to watch me struggle, but I'm gonna call it pick up pizza.

I won.

And then of course, our parentheses, close it out.

We already did our code block ahead of time.

And there you go, we have converted this to a method successfully.

Now I'm just gonna do the same thing for our second chunk of code.

Just a bit different in my process here, pick up what is this candy and i three that do that.

Oops.

We're going to get rid of this.

And then we'll use the bottom automatically formats.

Thank you.

Visual co And there we have it.

And over in Python again, let's say that when you pick up something, you also do like some UI stuff and some visual effects.

And you also do, you know, you update whatever information you need update and slot, one of your inventory, you also update whatever's going on.

And slide two, for example, so on and so forth.

I'm just gonna copy this and bring this down to this one as well fixed the format a bit.

And you can see the script got a lot longer.

So let's convert those into methods.

Now, you already know the syntax for methods in Python, we simply just replace void with def, and then we name our variable is going to be pick up pizza, Inventory Slot, one, starting in parentheses, and then our semi colon.

And then we have come down to all of this and then hit the tab button so that this counts as a code block for that method.

And let's do the same exact thing for our second chunk of code.

def, what is it pick up candy, inventory, three, starting in parentheses, and then our colon, and then come down to all these lines and indent the man.

So they count as a code block for this method.

Now, we need to pause if you take a look at our inventory, three variable, and even our inventory one variable, they are underlined red, which means that we have a problem, it would come down to our console and press problem, we see that word is telling us that these variables are not assigned.

What's going on here? Well, this has to do with something called scoping.

And Python is very peculiar about your scoping to simplify, this block of code is self contained only within this method, pick up pizza inventory one, he doesn't have any reference to anything outside of this code block.

And of course, same goes for this code block as well.

So one simple thing we can do to let these code blocks know that there is a variable called iron v one outside of its scope, which again, is this, we can simply just come at the top of it, and then type global and then I N v one.

Same down here, we can type global, and then type ion v three, and you can see our problems are gone.

Problem solved.

What we can do now to compress our code is grab all of these lines here, which contained both of our methods.

And I'm going to hit Ctrl x or cuts.

And I'm going to now move this to the bottom of our entire program at the very end, and D realize what just happened, pretty much our program ends here.

So everything before that is our actual program, look how much shorter that is.

And over in Python, we can do the same exact thing.

I'm going to select all these lines that have our two methods here, hit Ctrl, x or cuts.

And then I'm going to move that up.

And then underneath our print function, I'm going to hit Ctrl V or paste and put that underneath.

And again, right here, our program ends here, much, much shorter.

However, our code is now compressed.

Yes, but we aren't completely done yet.

Over in C sharp and the left, you can see that if I hit the start button up here on top and bring the window over, you can see that our entire inventory is still empty.

And the same goes for Python, if I hit the play button, you can see that we have empty, empty, empty.

And the reason for that is because at no point did we call our methods.

And to do that in C sharp over here on the left, all you have to do is simply just write out the name of your method.

So our first one, we want to do pick up pizza for one.

And then you also need to include your Start and End parentheses.

This is what denotes that it's a method.

And then we need to do pick up candy inventory, i three started in parentheses, and then our semi colon.

And to prove to you that this works, like I say it does, I'm gonna hit the start button, and then bring the window over and you can see that they have now been set, check that out.

Now over in Python, it's actually quite different, although the concept is still the same.

So earlier, I moved off our methods to the bottom of our Python script.

But if we were to come into the middle of our program, and then type out, pick up, what is it pizza item one, and then start in parentheses and then run our program, you'll see that we get an error because pizza pickup pizza item one is not defined yet, or inventory one rather, is not defined yet.

And so a truth about Python is revealed.

using methods in this context isn't really all that useful because the order of operation is extremely important in Python.

So to use our methods, we have to initialize them before we call them For the first time in our scripts, but also after we initialize the variables that we're using within them.

And where's that sweet spot you ask? Well, it's right here.

And so I'm just going to select all these lines that contain our methods.

And then I'm gonna hit Ctrl, X to cut and then Ctrl V to paste.

And there you have it.

And just to prove that everything is exactly what it needs to be, I'm gonna hit the play button up here in Visual Studio code.

And you can see that we get pizza, empty, empty, hold on, That's not right.

Of course, the reason for that is we have to call the second pickup as well pick up candy I three star in parentheses at the save the play button, and voila, we got pizza, empty candy.

Okay, so that was one use case for methods.

But I want to show you another one, I'm gonna start by removing all the code that we did, and C sharp and Python so that we can set up a new scenario.

By now imagine that you have some program with some sort of boss battle in it.

And every time that you successfully hit the boss, two things or more happen, so I'm just going to quickly code up this scenario.

Alright, so I went ahead and code up the scenario off screen, because otherwise would have been another couple of minutes of silence, but I'll walk you through it.

So here we have a few integers initialize, we have my HP the enemy HP and some money, then we have some Boolean to check if we hit legs, arms or head, set them all to be true.

And then we simply have some if statements to check for those volumes.

And if any of them are true, then we simply will minus HP from the boss and then add some money to our bank account.

And Python does the same exact thing.

Same variables might be in PHP and money, and then some hit legs, hit arm and hit head bullions.

And we simply check those blades.

And if they're true, then again, we're going to minus HP from the enemy and add some money to our bank account.

And that's all it's to it.

And so the next advantage that methods could give you is reducing repetition, if you haven't already observed, and both scripts, we have this chunk of code right here, enemy HP minus equals one, and money plus equals five.

And this is repeated over and over three times each on both scripts.

And I mean, that's fine.

In all, I mean, this will do exactly what you expect it to do.

However, we have this rule in programming, and it goes as follows.

never write the same code twice.

In addition, imagine that you want to add something else to these hit events.

Like for example, let's say that you wanted to take your HP and add a little healing for every successful hit, right.

So you would come down here and do my HP plus equals two, for example.

But the problem is that you now have to write this for every single hit event.

So my HP plus equals to go to the next one, again, my HP whoops, my HP plus two equals two.

Now there is a clear pattern here.

And there's no reason for you to repeat this over and over and over again.

And so let's bring back methods, all we have to do at the end of our main function here is write out void and then name our function, let's call it I'll just call it hit event.

Sounds good enough to me open starting in parentheses, and then come down here and your code block.

And let's just write all this out.

Any PHP minus equals one, perfect money, plus equals five, and then my HP plus equals two.

And so now all we have to do is simply just remove all of these and replace them with hit events.

Starting in parentheses, semi colon, and bottom being do that for all other spaces as well.

And do hit events.

Start in parentheses, semi colon, oops, get rid of that line.

And then of course here as well hits events about bomba bomb and bada bing.

And there you have it, we have greatly reduced our repetition.

And of course, just to prove to you that all this works, and we come to the end of our script here, which again, ends right before our method is called.

So in script, and then I'm going to add a console dot write line.

And we really just want to know all of our variables, so enemy HP, and then I'm lazy.

So I'm gonna hit Ctrl, C Ctrl, v a couple times and then replace this with money.

And then replace this with my HP.

Come up here, hit the start button.

Up, it's going to close Of course, we have to hit console that read key always forget this.

Probably a bit.

So use the Python, hit play, bring the window over and you can see that we have our calculations.

I mean, there's not going to confirm that they're what they are, but trust me, it's working and now over in Python, this technique has a lot of benefits, but it's still limited to the order of operation.

And so again, to implement this in Python, we simply just go after our variables that we're using are initialized.

But before we call it, which that sweet spot is right here, and so we can do def, what do we call it? I forget hit event, hit events, and then start in parentheses there.

And then I forgot some, just regular colon.

In our code block, we can just bring in this right here, I'm lazy.

So I'm just copy and pasted by being and then we can replace all of these with hit events.

And then I'm going to copy this because I am lazy and copy this as well, because I'm lazy.

And you can see that we have our issue again, and you can see that we have our scoping issue again.

And you can see that we have our scoping issue again.

And you can see that we have our scoping issue again.

And to fix this, all we have to do is just again, add our global, and then we need what enemy, HP and money.

Perfect.

And so now to prove all this works, I'm just simply going to repeat what we did in C sharp and do print and PHP.

And then we also want to print our money.

And then we also want to print our my HP.

I boom, except for the HP Of course, because we didn't add that.

But it's a lot easier to add things.

Now, instead of having to go through every single event, we just go to the actual hit event method.

And then we can do my HP plus equals to I believe it was I'm just double check here.

Yes, it was too.

And we need to set that as a global as well to grab that from our scripts.

And then I can hit play again.

And you can see that we have the same exact variables 2715 and 16.

And there you have it for reducing repetition with methods.

Now, I just want to show you one last technique with methods and that is returning values.

To do this.

Again, I'm just going to get rid of all the code that we did already sing with Python.

And now imagine this scenario.

And so I went ahead and wrote this scenario of code off camera, because otherwise, this probably would have been about a 10 minute silence.

But as always, I'll walk you through it First, consider the scenario that you're developing some app or some social media or something like that.

And you want to generate a user ranking for all of your users.

Now, what's going on in our program isn't really important at all, honestly.

But here we have our user rank variable.

And let's say that we want to generate this user rank using these variables here.

Well, I just came down here and just made a pretty big tree, and did a bunch of checks.

So if guests then minus something if page, plus something else.

Plus, if this is all arbitrary, I just want to make a really big tree to demonstrate this next example.

So let's just say that all of this right here, actually starting here, all this right here is like an algorithm that you and your social media your app team has developed.

And you guys have concluded that it's a very accurate way to assess the user ranking of your users.

Well, instead of having this algorithm hard coded for a single variable, we can convert this algorithm into a method and have that method return a value.

And so to do that, we only need to do two things.

First, let's convert this algorithm into a method.

Now, this is still hard coding our user rank variable.

This is no different than just a regular method.

So what we need to do next is we need to create a temporary variable and we'll call it actually temp, and then let's set its equals zero.

And then we need to change all the user ranks to be timps.

Or the temp variable, my apologies.

So I must say temp here, use a rank.

I'm gonna go right here temp and then use rank here is also temp.

And then use rank here is also temp and then use rank here is also Tim Hahn this user rank is temp is well.

And this final one is to at last No, we have to do is come to the end of our method, and then do return tip.

Now, you'll see that we will get an error here.

And the reason for this, it requires a bit of explanation.

So when you initialize methods, you are also casting its data type.

And so if we check out our score method, you can see the data type for our score method is a void, which is essentially data type lists.

So our score made through essentially just go through its code block, run that and then exit out but if we wanted to return data of some type, all we have to do is replace this with that data.

Type.

And seeing that our use rank is a float, we're going to replace this with a float.

And you see our error has disappeared.

And so what does that allow us to do? Well, I'm going to do our convention, our program ends here.

And then I'm gonna go down and find these two things, and then Ctrl X to cut them, and then put them before programmings.

And now all we have to do is just assign a score to our user rank variable.

Isn't that nice? And let's say that we have another user rank that we want to calculate, right? This is easier rank two equals zero.

Well, all we have to do now is just go user rank two equals score.

And nowhere in Python, we can do the same exact thing, just first wrap our algorithm here into a method was called score.

And do that and then now we need to select the entire algorithm, and then hit the tab button.

So that is all within the code block for a score.

And then because it's a method, hopefully something broke here, what broke here.

Now I'm not entirely sure what happened here.

But to fix this, we simply just add a tab fix the syntax, error disappears.

Perfect.

Next, we'll add back in our temp variable.

Let's just initialized this temp equals zero.

And then was replace all the user ranks with temp.

I'm just gonna copy and paste because I am pretty lazy right now.

temp, temp, temp, temp, temp, to temp.

And then at last we just come out I think this is it.

Return tip seven double check, this is the right place to put it.

Yes, it is.

Now again, because this is Python, this method isn't that useful for compression, again as to be in that sweet spot.

But we can get our user ranking simply by calling user rank and then assigning score to it.

And so now to prove to you that these do exactly as I say they do, over here in C sharp and left, I'm just gonna copy and paste this right line, because I'm lazy, then added to there.

And then we have read key.

So now I'm gonna hit the start button.

And then I'm gonna bring the window over.

And you can see that we have 49 and 49.

And to prove the same thing to you in Python, I'm just gonna initialize a new user rank here, use rank two, and that also equals score two.

So we have the same exact scenario.

And then we're praying user rank two.

And then I'm gonna hit the play button up here, you see we have 49, and 49.

And yeah, there you have it.

If you want to learn more about methods, I think the best thing that you can do is just to start using them more, because you'll learn more about them in the process.

But that is everything that you need to get started with programming in regards to methods, functions functions, let's step into the wonderful world of functions.

Now I'll just go on record saying this functions are hands down the most valuable tool to program.

Now, why is that? Well, functions share a lot of commonality with methods for they allow you to be able to reuse code giving you the ability to write more neat and nice code, which in effect makes it easier to read giving you a better grasp on your code.

But the advantage that functions have over methods is that you can pass in data and slightly alter the code that is ran within a function making them extremely powerful.

So for example, say you have an inventory class that can hold four items and you want to remove the items.

Well, instead of creating four different methods that you can call to remove the for various items, inventory dot remove item one, inventory dot remove item two, so on and so forth.

That will all run the same exact code minus may be a variable or two with functions you can pass in, for example, the item number and using the same code can remove that item.

Now talking about the theory of functions is great and all but let's take a look at how to use functions practically with code because I promise this will become so much easier to understand.

And we're going to do this using two different languages because I think it can be really helpful for you to see how they compare and contrast.

And plus, you'll pretty much learn two languages at once.

So on the left is the language C sharp using the ID Visual Studio, which should interest you if you want to do windows development or make games using a popular game engine called unity.

And on the right is language Python three using the IEEE Visual Studio code which should interest you if you want to get into more general programming or data science.

Alright, so here I have two brand new console projects and if you don't how to make a new console project and either C sharp or Python or both.

Be sure to check out the video in the description.

And it's called How to install an ad.

And at the end of that video, I'll show you how to do that Paul Wright, who's ready to have some fun with some functions.

Now before we can do that, we need to go over the syntax for functions in both C sharp and Python over on the left and C sharp, I'm going to get rid of these two lines, they come standard with every new console project, but I don't need them.

And then in this code block, I'm going to initialize a function, which, if you're familiar at all, with methods, this is going to seem very familiar to you, I'm just going to type out void, and then the name of our function, which is called F for now, and then start in parentheses.

Now, if you're familiar at all, with methods, you're probably looking at this and you're like, Wait a second, that's just the method what's going on here.

And yes, you're right methods and functions have a lot of overlap.

But what makes functions super cool and extremely useful is that you can pass in some input.

So if I type in right here, if I initialize an int, and then I'm a call this x, for f of x, that's a standard notation for functions, I can now make my code block here.

And we can do something with this input within the code block.

For example, let's say that we want to take our input x, and we simply just want to times it by two.

So I'll use the multiplication operator and then times it by two.

And then to see this change, let's come down here and add a console dot write line just to print to the console.

And then we're going to put in here our x variable.

Well, now we can do something cool with this function, if I just come to the beginning of the script, and then I'm going to initialize an integer, I'm going to call it, I don't know my number, for example.

And then let's make it nine.

And so now I just want to call F and then pass in my number, which is nine.

And what it's going to do is it's going to take my number in this function, and then here is just going to times by two and printed out.

And to prove that to you, I'm going to come right underneath our function and add a console dot read key, so that the terminal doesn't close on us.

As soon as we run it, hit the start button, and our terminals over here.

And you see that nine times two does in fact, equal weighting.

Now in Python, the syntax is a bit different.

I'm just gonna start off by initializing our integer, my num, assign a nine to it.

And then our, our function has to come before we actually call it.

So I'm going to initialize that, first, I'm gonna say def, with the name F, and then we're in past nine input x, and then I'm using a colon here, go down into the code block, and then I'm going to do X times equals to no different than what we did in C sharp, and then simply just print out whatever x is, then lastly, we can just call our f function by saying F and then passing in my num, knowing my num when I do my num, and there you have it, I'm gonna press the play button just to prove to you this works.

And bada boom, you see the web 18.

Now, we just barely scratched the surface with functions.

But hopefully, you can already see how much power we have with just this very simple example.

Allow me to show you one more example.

Before we move on.

Imagine that we have a list of names and we want to add Mr.

or Mrs to the beginning of those names, well, we can simply get rid of this integer no longer need that.

What else do we don't need, we actually don't need this function anymore.

So we don't need this will keep the console actually let's just get rid of the whole entire program and start over from scratch and do the same for Python.

So let's initialize a string array.

Let's call it a name.

And then that equals a new string array of size.

Let's Let's initialize sizes to make it simple.

And then we can come in here and manually set the variables within our array.

So I'll do zero equals, let's say his name is Johnny.

And then let's say that name of element one is equal to Carla.

And then name of element two is equal to let's just say that Zack, and I suppose Zack, thank you.

So now let's write out our function that will do this process for us.

I'm going to come down here and I'm going to do a void and then let's call it surname, I believe they're surnames.

And then we can pass in.

Let's see, a string and this is going to be It was called sir as the variable.

And so now we can do down here name of zero equals sir, plus name of zero.

And then of course, let's let's print this out so that we can see what's going on console dot write line.

So what I'm looking for, and we can print out name of zero.

Come on, there we are.

And then we can call our surname here.

And then let's pass in Mr.

Mr with the space there.

And then of course, console dot read key.

So a terminal doesn't close on us.

Also, I'm just going to write right here, just because it's fun to make the distinction that our program is here.

And so I went ahead and wrote out the program in Python, so you don't have to sit and listen to my silence for a couple of minutes.

But it does the same exact thing.

We have the nameless here that is initialized with Johnny Carla and Zach in it.

And then we initialize our surname function that takes the input of sir.

And we essentially just assign sir, plus the name of element zero, to name velleman, zero, so we essentially reassign it, and then we print it out.

And here is when we call the actual function itself.

And so if I just come up here to the play button and press it, you can see that again, we have Mr.

Johnny except for I put the period in the wrong spot supposed to go there, press it again, bada boom.

Alright, cool.

So now we have a surname function that adds a certain name to our names, however, we have three names.

And I really don't want to have to write three different functions just to do this.

Well, thankfully, we don't have to, thanks to this next feature that further makes functions even more powerful.

So there is no real limit on how many inputs we can pass in with our function.

And at the fact that we're using an array here, we can just pass an integer to change whatever element in the name array that we want.

And so to do that, I'm just going to add an integer variable at the beginning here, we'll call it, I'm just calling ind for index.

And then we can simply just replace this zero here with ind whatever, integer we pass in i n d again, and then i n d.

And lastly, we just come up here and then just pass in the zero.

So we want to change the zero element in the name array, which corresponds to Johnny run that again, by hitting the play button at the top here, bring the console window over, and you can see nothing has changed.

And so now that we have this add to flexibility, I can simply take this line, and copy and paste, copy and paste, copy and paste, and just change the index to one which is Carla, and two, which is Zack.

And of course, Carla is not a mystery.

So we can change that to a message here.

And when we run this, it's going to print out all three of them.

So I'll just press the play button again, and bring the window over.

And would you look at that, and Mr.

Johnny, Mrs.

Carla and Mr.

Zack function is working perfectly.

And over in Python, we can do the same exact thing.

So I'm gonna pass in an input variable here called ind again, separate them with the comma that's important for both syntaxes separate your variables with commas.

And then we can replace all of the element numbers here with ind, and then just pass an integer in when we call the function we get there.

Right here.

So Mr.

Zero.

And then of course, we can do copy, paste, paste.

And then one and two.

Carlos misses the Save button clears all errors, then hit the play button.

And would you look at that Mr.

Johnny, Mrs.

Carla, and Mr.

Zack, I'll never stop saying this.

But functions are the greatest thing there is high love functions.

And if you think that it stops there.

Well, you're in for a bit of a surprise.

But first, let me introduce a problem to you say that we want to come down to the bottom of our program and initialize a new string, right? And the name here.

Let's just say this is the boss's name, and it equals Helen.

And now what if we wanted to add a surname to Helens name? Well, because this surname function is directly tied to the name array.

We kind of can't at the moment, I mean, of course, we could just come in here and just add it manually, Mrs.

Helen, or we could remove this and then just come down to the next line and do something like bossy cool.

What is it Mrs.

Plus boss here.

And then we also want to do a console dot Yeah, we could redo the same code over if we really wanted to imagine that you were doing this as an automated task, well, you wouldn't want to manually go and add the surname to all the names that you have.

And you wouldn't really want to rewrite the code over and over and over.

And so the solution to this problem is by changing this function from being a variable dependent function into a variable, independent function, and we can do that by using the return statement.

And so to do that, first I'm gonna get rid of these two lines, because they're just for an example.

And then I'm gonna go into our surname function, and we're going to return a string.

So I'll initialize a string, I'll call it temp, and then I'll sign it to be an empty string for now.

And now we have to replace all of the variable references to the name array into the temp, because this is what makes this function variable dependent.

So I'm gonna change this here to temp.

And then I will change this one to temp as well.

And then I'm gonna change this here to temp.

And actually, because we need an input with the original name is we actually don't need to initialize this here.

So I'm going to get rid of that line.

And we can now change our integer variable input into a string variable input and call it temp.

And so the very last thing we need to do here is we need to change the data type of our function from a void to be a string.

And then you'll see we get an error saying that it doesn't return a value.

When you cast the data type on your functions, they have to return the same type of data type in the return.

So we'll go down here and add, return and temp is a string.

So we'll just return back the temp which has been modified with sir at the beginning.

And so now because we change the input to surname from the data type integer to string, you can see that we have three errors here.

For the times that we called it, these are currently integers, they need to be strings, which is no problem, we can just input the actual name that we want to change here.

So of course, the first one is name of element zero, and I'm lazy.

So I'm gonna copy and paste this, paste and paste and change this to one and two, which again corresponds here.

And if I just hit save, and then the Start button up here, and then bring the console, you can see that absolutely nothing has changed function works exactly the same.

However, the very last thing that we have to do to make this completely functional is, again, right here, it's printing out the temp, so this is only temporary, we get a reference to that, and then we change it and then we return it.

But you can see here that's that's not being assigned to anything.

So that's the final thing that we have to do here.

But before we do to further illustrate my point, I'll simply come at the bottom here and do a console dot write line.

And then we're going to print out name zero, and then I will copy paste few times because I'm lazy, changed to one in two.

And so if I come up here and hit the start button and bring the console and over you can see that yes the certain names are added for the first three which is what is inside the actual surname function.

But the last three that were printed which is outside the surname function is the actual ground truth to are named of zero element name of one element and name of two elements are still the same exact as we initialized it.

And so to fix this, we simply just have to assign it whatever is being returned right here.

So name of zero equal surname with the inputs and name of one equal surname with the inputs and name have to equal surname with the inputs come up here hit the start button, bring the window over and you can see that they have actually been assigned.

And just to walk you through what's going on here.

On these three right here we will assign that name of zero element name of one element name with two element will equal surname with some inputs.

And so we go into the function and we pass in the inputs.

temp, which is the actual name at the moment and then surname is a name that we want to add to the beginning of the name and so we will assign the surname to the beginning of the name and then we will print that out and then we will return temp.

And so because this whole function right here, is returned with the value whatever temp is which again is calculated here, we will assign that return value to name of element zero named value one and name of L admit to.

And now at last to bring it full circle.

Now that we have this flexible variable independent function surname, we can initialize our boss string here, which equals Helen, and simply just reassign it by going boss equals surname.

And then we're going to pass in boss here.

And we can pass in Mrs.

And as simple as that.

And just to prove it to you, I'm going to get rid of these three lines, make it a bit less confusing, hit the star button and bring the window over.

And as you can see, we have Mr.

Johnny, Mrs.

Carla, Mr.

Zack, and at the very end, Mrs.

Helen.

Now that is how you write good code.

And so we're in Python, we can make this change really easily as well, we can simply just change this to say temp, and then change this as well to say temp, and then change this one to say temp.

And of course, we want to change our input to be temp, oops, and then come down here.

And then we want to assign this to be name of zero, and then this one to be named one.

And then this one to be named to.

Of course, and then we need to assign this here name of zero equals surname with these inputs, and then name of one equals surname with those inputs, and then I'm lazy.

So I'm gonna copy and paste the last one change that to name a surname equals the last of those inputs.

And of course, I'm getting an error here.

It's saying that assigned to a function which doesn't return, I forgot to return here.

So we're simply just do return tip.

And then of course, we can't forget our boss, Helen.

So we can initialize that by saying boss equals surname.

And because we're initializing this, we simply just pass in Helen.

Like so.

And then Mrs.

can come up here, hit the play button.

And voila, Mr.

Johnny, Mrs.

Carla, Mr.

Zack and Mrs.

Helen functions are just absolutely incredible.

I love these things.

We barely scratched the surface with what's possible with functions here.

But hopefully, your creative juices are flowing in, you're thinking of different ways on how you might be able to apply a function.

I've said it before.

And I'll go on record saying that, again, functions are probably the most powerful tool when it comes to programming.

In fact, if you're familiar at all, with all the breakthrough research that's happening in the field of machine learning, well, it's all powered by functions.

So I hope I was helpful for getting you excited about some functions.

But that's everything you need to know to get started with programming in regards to functions.

Now, commenting can be a make or break for your coding success, especially if you're working on a team on an open source project or on a project, you plan to work on long term comments, just as you expect our way to leave comments within your code in a human readable format, so that you know what's going on in different parts of your code.

At all times, sometimes you'll write out extremely complicated code that makes perfect sense in the moment.

But when you return to that code months later, or give it to someone else, so they can add on to it, it may be really difficult or a ton of wasted time trying to reverse engineer the code.

So let's take a look at how to use commenting in two different languages.

Because I think it can be really helpful for you to see how they compare and contrast.

And plus, you'll pretty much learn two languages at once.

So on the left is the language C sharp using the ID Visual Studio, which should interest you if you want to do windows development or make games using a popular game engine called unity.

And on the right is the language Python three using the ID Visual Studio code, which should interest you if you want to get into more general programming or data science.

Alright, so here I have two brand new console projects.

And if you don't know how to make a new console project, neither C sharp or Python or both, be sure to check out the video in the description.

It's called How to install an ID.

And at the end of that video, I'll show you how to do that.

Alright, so the first thing I want to go over is line commenting.

So over in C sharp and left, I'm just going to remove these two lines that come stock with every new C sharp project.

And I'm going to start creating a little fake project.

So I'm going to initialize a couple of floats.

We'll call this location x is going to do one 2.345 F and then we'll do another one float location y and we'll do 123 point 456 All right.

Oh f Sorry.

Alright, so these variables are just going to act as fate coordinates for and lo example.

So I'm gonna create a more involved Boolean, I'm gonna say bull in oops, in position, let's say in pause equals, and let's do location x is greater than, I don't know, let's just say 12.

Right.

And then we'll also check if, if location, y is less than 30, for example.

But then outside of that, we'll also check, or if I'm about to go off screen here, I'll scoot over, or if location, x is greater than location, y, and then we'll put a semicolon.

And now we have a more involved bullying.

Alright, so here, we have maybe one of the greatest examples of how line commenting is pretty useful, or it can be pretty useful.

Rather, I'm going to go on top of our bullying here, and I'm just going to do forward slash forward slash, and that right there, it starts our comment, and we can write whatever we want.

So I'm just going to do my best to explain what this Boolean does.

So if location, x is greater, is greater than 12, and 12.

And location why why is is greater, no less than, less than 30.

Or if location x, x is greater than location, y, y, then we are in position.

Sorry, it's a bit long, and it doesn't exactly fit with the rest of the code.

But that is how you write a line comment.

And the way it works is when your code is compiled, anytime that the compiler sees a double forward slash, it knows to ignore everything after it.

So just pretty much will go to the next line.

And over in Python, it's a lot of the same, I'm just going to do loke oops, loke x equals one 2.345.

And look, y equals one 2.412 3.456.

And then I'm going to do in pause equals, let's see loake x is greater than 12.

And what is the loq? Why is less than 30? Hmm.

Or we have look loq already forgot x is greater than x is greater than look Why? Boy, that was brutal.

And to add our comment, I'm just gonna come over here above our in position variable.

And instead of doing forward slash forward slash, that form of currency is not accepted in Python, I'm going to hit the pound sign or the hashtag, whatever you call it, and then I was going to write out our message.

So I'm not going to write it because that's going to take forever again, I'm going to copy it from here and then paste it.

And there we go.

Comments, and comment.

Sorry, I just realized the Python font should probably be a bit bigger.

So I'm just gonna make that a bit bigger.

Yeah.

So that's one use case for line commenting probably one of the most useful cases for line commenting, however, you can do something else as well.

So let's say that, you know, we try out this Boolean and it just isn't working right for for whatever reason, well, we can do a line comment on everything after the assignment operator, and then just put, like, for example, equals one, just to make sure that oops, we actually need to put my true here, just to make sure that this Boolean is actually working, just for example, and then in Python, it's all the same, use the hash tag, everything after that it's ignored, and you just put true oops, true.

Oops, no semi colon.

And Yep, that's another use case, that can be quite handy as well when debugging your code.

And so the final use case I want to show you with line commenting is let's say that we're going to return these back to that assignment.

And let's come down here.

And then let's add an if statement.

So if in position, right, we want something to happen.

However, we don't exactly know what we want to happen yet.

We have an idea maybe maybe we don't know how to do it.

Maybe you want someone else to do it.

Well, what we can do here is just add a comment.

on like, here, I want to display something, you know, some notification, I don't know, I just want to display something here.

And you can leave this comment here, maybe come back to it later, maybe give it to a friend, maybe do some research and then you know, learn how to do it and then implement it.

This comment is just an easy way for you to, you know, know what your intent was with putting this if statement there.

And in Python, it's really similar, but a little different.

So let's say we do our if statement, if in position, we'll come down here, we can write our comment, which was, again, copy and paste, copy, paste.

However, we can't leave it like this, you see, if we had saved, we will have a problem, which is, we have a parsing error, a syntax error, rather.

And the reason is, because if you do if you do an if statement, and then you indent, which you have to do, there's there's nothing when it runs as if statement, it's not going to run anything.

And that's a syntax error in Python.

So we can just simply put, like print, you know, zero, for instance, just so that it clears that syntax error.

And technically speaking, you don't even have to do a print, for example, you can just do like empty quotes, whoops, you can do like empty quotes.

And that will work just the same, but it has to run something within the indentation.

Because again, this line is ignored.

Alright, so that was line commenting.

Next, I want to talk about block commenting.

So to demonstrate, I'm going to get rid of all this code that we just did.

And then oops, yeah.

And then I'm going to, let's just say that you're creating some like, complex algorithm that you quite understand, but you kind of don't understand.

So I'm just gonna create something, it was just a representation for an advanced algorithm, just use your imagination.

Let's do loq y, divided by equals four, right? And then we need to return it or something like that.

So we'll do local New equals loake y divided by loquax.

For example, oh, I have to initialize that this is not Python floats.

And then finally, let's just return it.

Let's do.

Let's do this console.

Oops, console dot write line.

Right? line, location, new.

All right.

So let's just say this is some advanced algorithm, and you just implement it in your program.

But all of a sudden, like everything's broken, nothing works anymore.

You're like, what's going on? This isn't behavior that I expect, I know that this is working, right.

This is obviously, you know, very straightforward.

But maybe this part of the algorithm isn't working right.

Now, you could, you know, go by and do like, you know, forward slash forward slash forward slash four slash.

And if you have a bunch of these do that line by line.

But one really convenient ways use block coming, which in C sharp is just one forward slash, and then an asterick.

And the after ended doing the opposite, so an Asterix and then one forward slash, and that is one way that you can quickly comment a whole block of code.

Now one really important thing to take note of a block commenting is that you have to have a start, and you have to have an end.

Because if you don't have an end, what happens here is that it comments out everything after it including the brackets.

And if the brackets has a start, but doesn't have an end, you're going to get a bunch of errors.

So they all I always have to have a start, and they always have to have and now in Python, I'm just going to replicate our super advanced algorithm here, I'm going to do loake x times equals two and then loake y divided by equals four.

And then we're going to do loake nu equals loake y divided by loake.

x, then we'll just print it because why not look new.

And to add block commenting in Python, it's similar, but also very different.

And what I mean by that is you want to come up to above or if you want to do your block, comment and just do three single quotes.

And again, it needs a start and he needs a finish.

If you do not have a finish, you are going to get a syntax error, because it needs a start and a finish for the triple quoted string literal, aka the block comment.

Now the very last type of comment that I want to go over is summary commenting.

So to demonstrate, I'm just going to get rid of All this code is no longer needed.

And then I'm just going to initialize a float variables, call it loke equals zero, for example.

Next, let's create a quick little function, I'm going to go outside of our main function and then do static float.

Let's call it ret, one.

And then let's, let's pass in a float, and then we'll call our float a sum, make it easy.

And then what we're going to do is we're going to return a, let's see a plus one.

That's what we're going to return.

And then let's just use it real quick.

So we'll do loke equals rat one, and then we'll just pass in itself.

So it's going to plus one to itself.

And just to prove that we'll do console dot write line, even though it's not about proving in this, it's really about comments, but we'll just do that anyway.

Console dot read key.

And then I will hit the play button.

And boom, there we go.

Zero plus one equals one.

So our function works.

But let's say that you know, it's later down the line in your project, and you come back to the script to upgrade or fix something, you see that Loki goes right one, what does that do, and you go down to the read one function.

And let's say this is a lot more complex, you don't really understand what's going on.

Well, you might waste a lot of time reverse engineering to figure out what that function is.

But what SOT what can solve that is by adding a summary comment.

So adding summary comments in C sharp is actually really easy.

All you have to do is go right above whatever function that you want to add a summary to or method and just hit backslash, backslash backslash, it will autocomplete if you're in Visual Studio, meaning just fill in whatever your your summary is.

So I'm going to do plus one to the input.

Now, if I go over the red one, you'll see that now there's a little description there.

And it tells me exactly where does it pluses, one, two, whatever the input is, the input is Loke.

So it's going to be local plus one is what it's going to return.

Simple, easy, and to the point.

And they also have some other variables that you can fill in, you can fill in like whatever the parameter A is, you can put out what that is for you can put out whatever returns, and in the right context, it will display that information for you as well.

And over in Python, I'm just going to get rid of everything and set up our scenario real quick.

So loke equals zero doing a do def read one, and then we need our a input.

And then let's see return, whoops, return a plus one.

And then we just simply do loke equals what is the right one, and then pass in Loke.

And then we can print low out, and then we don't need a input.

And just to prove that it works, I'm going to hit play up here and you see that we have a one.

Now to add summary comments to Python methods and functions, all you have to do is go right under the method or function in Python, and then hit three single quote characters, and then another one.

So you pretty much block comment.

And then you just type whatever the function is.

I'm just gonna pop copy this because I'm lazy.

And then I'm going to paste it here.

And so now if we go over here, it shows you what it does definition red one, it pluses one to the user, I'm sorry, to the input.

And then we can add more if you want like a equals, you know, float, for instance, just more information for the user.

And that's pretty much all there is to it.

And there you have it, guys, that is pretty much everything you need to know to get started with programming in terms of comedy.

Well, all right, congratulations, you fully made it through the course.

Now, how do you think you did? If you really aren't sure, you should go back to the your first program lesson section four and retry it on a different tier.

If you're able to complete your first program on his hardest difficulty, then you know, you are officially ready to go out into the world to find your own problems to solve and code up your own ideas with your new found skill.

But before I let you go completely, I just want to pump you with some inspiration on the cool possibilities that you can take with this skill from here with more practice of course, but I just want you to think about everything you do these days.

Just think about the fact that almost everything you interact with in this new digital age is some way determined by code online banking, offline banking, text messaging, tweeting, watching this very YouTube video even driving your smart car now or using your smart toothbrush.

Lock your home with your Smart Lock or even using yourself Smart thermometer, the list goes on and on and on.

And of course, From this day on that list is only going to grow larger.

Our world is becoming more and more dependent on programs running the show, which is a whole other conversation.

But again, congrats because you at least now have what it takes to better understand and contribute to that landscape.

I wish you and your coding adventures nothing with the best.

And the last thing I want to leave you with is this bit of advice.

You're guaranteed to do amazing things with code so long as you follow this final rule.

Remember to always feed your curiosity.