You need to learn Python right now. Hold up. Why? What, why do you need to learn Python right now? The biggest reason right here, if you want to get a job in it or information technology, or you want to advance in your current job, man, youve got to know Python or at least learn it. Soon. Network engineer, Python, cloud engineer, Python, ethical hacker. You guessed it Python.
And honestly, thats my list. Thats my one reason.
Do you need another reason beyond the fact that Python is just cool and amazing and magic? Nah, probably not. So welcome to episode one of my Python core.
Want to teach you everything you need to know to become dangerous and Python.
And were starting from zero. Like I dont know what the junk Python is. Zero.
No pre-recs. And by the end of this course, my goal is for you to have the skills, just to be awesome and Python and whatever job you have. So yeah.
Get your coffee ready.
Were going to learn some Python and also a massive shout out to the sponsor of this entire series and the reason it can be free here on YouTube. It pro TV.
If you want to learn anything in it, they are my number one choice there. What? I used to learn stuff. Cloud hacking Linux and yeah, you guessed it.
Python like check out this awesome Python hacking course they have.
So check them out.
Use my link below or code network Chuck and get 30% off forever. All right.
Now lets start learning Python. So first, what do you need? What do you need to start? Learning Python? Nothing.
You wont need anything to start learning Python with me in this course. Yeah.
You can install and run Python on any computer Linux, Mac PC, but were not going to mess with that because that takes time.
And were going to learn Python right now.
I want you to start coding immediately right here in your browser.
And thats all it takes it.
Computer with a browser or heck even a phone with the browser. Oh, hold on.
I take that back. You wont need nothing. Youll need, um, youll need coffee.
Thats required just this. But anyways, check that link in the description.
Youll get access to my free Python lab through my free membership.
So click that link below, get signed up and lets start coding right now.
Now youll know youre in the right place. When you see something like this, this will be our Python environment. Our lab now real quick.
I want you to click inside here. Just any line in here. 1, 2, 3, 4, 5, 6, doesnt matter. And just start typing. Oh wait. Whats going on here.
You are invited to create a free replica account.
Replica is the tool were going to be using to do all of this Python stuff.
And if you want to be able to edit your code and save it, come back to it, all kinds of fun stuff. Youre going to want that for account again. Its free.
Dont worry about it. Just do it real quick. Once youre signed up, theyll come back and things will be great.
And once you have an account and you start typing in your editor, itll give you the option to fork it. Which sounds funny.
I know which basically means creating your own version of what Ive typed in here. Going click that its fine. Forking.
And now right here in your browser or your phone or whatever youre using, you have a Python lab.
So lets not waste any more time right here on line three.
Lets just start coding. Just copy what I do real quick.
Were going to write some code type in the word, print print, and then type in left, parentheses, quotation, mark.
Notice its filling in stuff for us as were doing that. So its like magic.
Im telling you and the type in hello world exclamation point actually lets do a couple of those four or five, six or 10.
Cause were super excited to learn Python and were triggering lots of coffee.
I hope thats your code.
Were done going click on the play button up here or the run button and lets watch what happens. Run. Boom. Okay. Hello world.
Down here in our Python terminal, we just ran Python code. Thats it.
Were done. Your code are now. No, lets talk about what we did here.
So when we said print, hello world and Python, we gave our computer a set of instructions. We said, Hey computer.
I want you to do something for me. I want you to actually say out loud or, and the terminal hello world. And of course he said, okay, Im doing it.
And boom, hello world. We basically made him talk.
But we had to tell him in a language he understands, which is why we use Python.
Python is a computer programming language.
And while this is a simple example at the end of the day, thats pretty much all were doing. When were using Python, were telling our computer what to do in a language. He understands now, as we go further in this course, and we go deeper into Python, we can tell our computer to do more advanced things like, Hey, go hack this other computer or go hack this network.
Or we might tell the computer, Hey, can you make this configuration change to all the devices in my network? And it will automate that really? You can do anything with Python and thats what makes it amazing.
Thats why learning Python is like learning how to do magic.
So lets keep learning some magic. Lets take another look at our code here.
So this point we know that when we said print, hello world, we told our computer to say hello world, but whats actually going on right here. Lets break that down. So first, what is print? What is that thing doing in Python? This is called a function which well cover more on later.
Let me show you how to create your own functions. Just no for now its code.
That does stuff. And in our case, the stuff that it did was make the computer talk. And in Python, you know, whats a function. When you see these parentheses right here, open and close without the hello world. Itll look just like this.
Now this next thing is a huge concept.
The south in between and our function here, that sucker is whats called a string.
You are going to use this so much in Python. So just get this in there.
Here we go. Coffee break. Who? Yeah, here we go.
A string is a sequence of characters or the way I like to think of it.
Its just text. So looking at hello world here, we have our characters H as a character E I mean, all of them are w even this space right here in between is itself a character.
And when we combine those characters together in Python, its called a string.
Now, how do you know if something is a string in Python? And he guesses, you will always see a string with quotes around just like this.
Bam, double quotes also be single quotes.
So if its like a one line from each side too, you get away, boom, boom, just single quotes. Thats also a string you can use either or, but my personal preference and what I recommend is to always use double quotes.
Its just better, but whatever you pick, just pick it and be consistent.
And also, do you remember this got a challenge for you for the next 24 hours? Every time you say string, I want you to quote it.
So string string just do it or dont I dont care, but its a good way to remember.
I think lets get back to our lab for a second. Lets try printing more strings.
So follow along with meals, print our ones well type in print using our print function. And this time, you know, lets go crazy. Lets do a single quote, just single.
And well say I am iron man. Just like that. Lets go ahead and run that code.
I clicking our start button up here. Our run button run and boom.
We just coded again. Hello world. I am iron man. Lets keep practicing.
Lets do another one. Print. No comma.
I am Tony stark. Lets do another one France.
Now I have a point to this. Just follow along. No comma.
I am now lets print that out. Cool.
So we have a lot of print functions, printing some fun stuff all real quick.
Just underneath that last print function, lets do this.
Do a hashtag hashtag insight bin. We are practicing Python. Its awesome. Now what just happened here? Lets try it out.
Lets run the code. Uh, nothing. Nothing, nothing happened or nothing happened differently. Right? New concept time.
Notice we also have the same thing up here. The hashtag, Hey, theres nothing here. Wake up. Then we have this.
When you see a hashtag or a pound sign, were telling our computer, dont read this the same for you, buddy. This is for humans only.
Were telling our computer to ignore that line in our code.
This is called a comment. And its for us. Its for people. Its for you.
As youre coding, you can make notes on what youre doing.
Thats for the next code, or that comes behind you and tries to make sense of the crap you coded.
You can go, oh, thats what hes doing. Cause he made a comment.
So whenever you add a pound sign in front of something, that immediately will comment it out or just tell the computer.
Dont look at this. Its not for you, buddy. Thats really handy. When, for example, I have the print, hello world. Up here.
This is code the computer will read and run.
But maybe just for this next time I run my code.
I dont want that to be included so I can just put a pound sign or hashtag right in front of it. And bam, notice it changed color. Its being ignored.
Now youve probably noticed this far, that things change color.
When we do cool things in here, this is a Python IDE or an integrated development environment.
So its definitely more than a text editor and it does cool things like that to help us code Python. And a lot of ways, its like a spellchecker. No, when youre typing in Microsoft word or whatever youre using, if you misspell something, itll tell you underline it with red, kind of the same thing here with coding.
So actually lets try something real quick. So we know that here, when we printed the string, no I am poppy. We know what the string, because there are quotation marks, but what if we remove those? What would happen? Lets try, lets remove them remove the last one.
And the first one, it was, first of all, it changed color.
And then we try to run it. Watch what happens. Ah, its your first big, bad red error, syntax error, which youre going to, by the way, get used to cause youre going to see this a lot. And its fine.
If you see it, every programmer sees this.
Every person who ever starts writing Python or any kind of code will experience this constantly. And youre one Google away from understanding what this means.
Now here its like saying, Hey, you probably meant to do a string and you didnt and its invalid syntax.
Add those quotations back in their sucker so we can run this code problem solved. So now you know what strings are, but what do you say? We have some more fun with them. Lets cover some string basics. Yeah, lets do this strings basics.
So weve got a task force to help us learn these strings basics.
Right now we have three print functions in our program. I dont like that.
Where I want us to do is get down to only one print function.
I want us to print this entire thing with one print function. And not just that.
I want it to look just like this. Exactly like this each on its own line.
And there are multiple ways to do this.
So were going to learn a few things about strings as we try. Now, first of all, if you already have an idea of how to accomplish this, pause that sucker, pause this video and see what you got. Now. If your first thought was like, Chuck, this is pretty dang easy. Instead of doing three separate strings, lets just write one big string that has all this text inside. Its good.
Thought. Lets try that first.
Im gonna comment out all this code so I can keep it here for reference that way. Its not going to be run though. Come down here and start typing away.
So well do our one and only print function and then our double quotes and Ill type in white text.
So now were using one print function with one string. Lets see what happens.
Lets run our code. Right? Okay, cool. We did it, but we didnt do it right? Because I wanted each of these things to be on their own line. Right.
We might think, well, this is just text. I know how to add a line in text.
You hit enter after the sentence. Right? So there and there, that should do the trick. Right? I am iron man. Im Tony stark, non poppy.
Lets see what happens. Oh, good. Old air.
Now you probably noticed immediately that, uh, some things change as we change that Python no longer recognized that this entire thing is string it. As soon as, since we hit enter to add a line break, we were done with the print function and we just did it wrong.
There is one really easy way to fix this.
You see this right here is just irregular string, but there are things called multi line strings. Ill show you.
Were going to add some extra quotes. So Im going to go up to the top here, right at the beginning of that string. And Im going to add two more quotes.
So now I have three double quotes. Im going do the same thing at the end.
Notice our color did change.
So were back in action there and lets run our code and see what happens.
Oh yeah. Look that mission accomplished this. My friends is a multiline string.
Thats exhausting. Three quotation marks. Well take care of that for you.
And we can do whatever we want inside that string.
We can add a bunch of space. Pretty cool.
So thats one way to accomplish this in one print function, but thats two.
Nah, Im going to make it harder for you for the next challenge.
I dont want you to, to make one big long string. No, no, no, no.
I want you to keep these individual strings in one print function again.
If you already know how to do this, try it out. Pause the video. If you dont, lets do it right now.
So this will start to open your eyes to the magic of strings and Python.
So once Ive been prints type in my first string, I am iron man.
How do I add another string to this print function? One way is to add them together. Im going to do a space, a plus sign, because thats what you do. When you add things, you use a plus sign. Python is no different. And Ill put in my next string. No, I am Tony. Sark lets go and do the next one space plus, and then no, I am poppy. Now this is a bit magical here.
We have our three strings and were adding them together with the plus side, which puts a whole new spin on word problems.
This is commonly referred to is concatenating. Did I spell that right? Yeah.
I think so. Concatenate or essentially combining things together.
So do you think this will solve our problem? Lets try it out.
You probably already guessed. No, but lets go ahead and run it.
Its going to have a problem. Youre probably not anticipating though.
So this is going to be fun. Ready? Lets run it. Okay.
It definitely combine them. But do you see something off about this, bro? You did give us spaces between our sentences. Thats basically grammar Python.
Come on. What is this? This combining them like, you dont know how to speak and the computer doesnt write the computer.
Doesnt speak English. Doesnt understand this crap understands Python.
And we literally told him to do that. Thats our fault. What do I mean, look at this. We said, take this string and combine it with this one as a human were thinking. Yeah, those are two sentences. Put a space between sentences. The computers like, um, I dont see the space character there because space is a character.
He hasnt seen, he went here and he doesnt see anyone here. So he just assumes, yeah. You want me to add those together? Then Im going to add those characters together. There is no space character.
There is no spoon anyways. So how do you think we fixed that? Glenn, pause the video and try it real quick. Its its very simple.
So dont make it too complex.
Just try to fix one of the easiest ways to fix this is by simply adding a space.
So like for example, here I am iron man.
We can add a space and I forgot my period earlier. So Ill add a period.
Just add a space at the end of that string. And when I run that code of Wala, weve got our space character there.
Lets do the same thing over here after our second string and our second sentence period space, Ill run that code. Beautiful. It looks better.
Doesnt it? Yeah, we did not complete our mission.
Remember I wanted each of these sentences or each of these strings on their own line as we did before. So how do we fix this again? If you already know video and try it, lets keep going and easy way to fix this is this handy hack right here, right in the string. Im going to do a backslash and the letter N and thats it.
So notice it is inside my string as part of the string.
Its a character. Lets run it and see what happens. Boom and bam. Okay.
So it created a new line for us that backslash in end is called a new line indicator character.
And it does what we just saw it did and sort of fix the rest of our stuff to make it look great.
Lets go and add one more new line character to our second string backslash N AML run that code. Now we did it and thats awesome.
But notice, um, its a little wonky, got a little extra space right here.
We may not want, how do we fix that? Well get the, computers going to take exactly what you told to do in Python.
So notice up here in our second string, weve got the new line indicator and the right after that, weve got the space character, and thats where that guy ended up right there.
Sort of fix that. We just simply eliminate that space and run our code.
Beautiful. Now, can I show you something that will make a lot of sense right now, but its super cool. And I just have to show you. Okay. Lets try it out. So, um, lets give it lush space here, type this with me.
Print for the CS, for our print function. Were going to print the string.
And then right after that, string had a space and asterisk space and type in 100. Now, what do you think is going to happen right here? Ill give you a hint. The Astros right here, Python reads. That is multiply.
You ready? Lets run our code and run. Boom, boom, boom.
How cool was that right? Talking about word problems. We can do stuff like that.
Yes. Python is powerful man. Now to make things cleaner and cooler.
What do you say? We add our new line indicator character.
Where would we put that to make it all on its own line? Try it out real quick.
Im going to do it here. Backslash in right after poppy.
Lets run our code now. Oh, gorgeous. I.
Am poppy. I poppy. I am. I am. I am popping poppy.
Ooh, we covered a lot today. First we established that. Yeah.
You got to learn Python right now because if you want to be in it, thats kind of the standard now. Sure.
It doesnt necessarily have to be the Python programming language.
It can be something else. But the defacto standard right now, the most popular one out there is Python for it. Professionals.
Ive been saying it for a long time. Check my previous videos, you got to learn Python. And the best time is always right now. We also covered, Hey, what? The junk is Python. At the way, we talk to our computer to tell him what to do to let them know were the boss.
And then we saw how we could tell him to do a few things like, Hey, talk computer, print this out. We learned the print function.
We learn what a string was also multiline strengths.
And then we learned some strings basics. And while we covered a lot today, we are just scratching. The surface Python gets so much more fun.
And in the coming episodes, just a bunch of mind blowing moments. Anyways, thats all I have for episode one.
Let me know what you think in the comments below.
Is there anything you want me to do differently, better or less of? I dont know. Let me know.
And also dont forget to hack the YouTube algorithm today.
Like this video comment, notification bell subscribe.
Weve got to hack YouTube today. Ethically of course.
And of course a massive shout out to the sponsor of this entire series.
It pro TV. Again, if you want to learn anything in it, if you want to become an it professional there, the best place to go to learn this stuff. So link below or code network. Chuck, you get 30% off forever anyways. Yeah, I think thats all I have. Uh, keep a lookout for future episodes. They will be coming out here.
Ill catch you guys next time.