 How's it going everybody? My name is John Hammond and welcome back to another YouTube tutorial So I'm still showing off a little bit of Python. We're on the basics last time around. We talked about data types Now let's move into variables and input and output. So variables input just creating a new file new script to save all the stuff and Keep in mind. We've already done output, right? We've already been able to run print statements We've already displayed hello world. We looked at data. We were able to add stuff together. We had numbers and text It was all cool easy stuff, right? Yeah, yeah, exactly. So let's print out Hey there What is your name and That's it. That's really all I want. We just wanted to have a program that will ask for your name And then we'll just kind of conceptually go through to demonstrate and demonstrate what all this stuff really is We get that output And now we want to get our input, right? so output in Python is With the print statement, but input in Python can be with functions called input or raw input. So input will only take Integers as your input as it has some that it will read in raw input We'll read in a string. So in this case since our program is asking for a name We're probably gonna want to use a raw input because that data is going to be text. It's going to be a string, right? right now I've been running this stuff in the Sublime text Kind of I don't know little IDE. I guess I don't even know what to call I've just I've been running it through sublime text, but since now we're gonna get input We actually have to you know Run in the terminal so we can have both input and output So let's check out that raw input function. If I run this It's gonna have an error. It's gonna have a problem when we try to run it in sublime text So we'll go ahead and run it within our Terminal I'm going to chmod our variable one Now when we run variables output, it says hey there. What's your name? I'll say my name is John and the program closes because that's all we have so far But let's give a little bit more to do We want it to say print Hello there It is nice to meet you Real simple, of course we run this. What's your name John? It says hey there nice to meet you easy enough, but We want our program to greet us, right? We want to know who we are This is where the idea of variables can come in We've been looking at data already with a bunch of these data types of strings and numbers, but They've been constant. They've been literals one isn't gonna change. It's always gonna be one John isn't gonna change It's always gonna be that value John Variables can vary hence the name they're allowed to change it can be x x can equal 3 or Maybe later on x can equal 4 or x can equal 300. It doesn't matter. They can change their state It's not a constant or literal like John or one or any other straight data type so Let's see how it works We've been able to assign stuff at least you've seen me try to assign things with that equals We're assigning with that operator equals We can now say name equals raw input as it's hello there. It's nice to meet you We can have it say you told me Your name is Print John oh, I'm sorry We want to have it print the name duh because that's the variable that we just read in now. We run this It's hey there. What's your name? My name's John. It says hello there. It's nice to meet you You told me your name is John cool I'm doing this all on separate lines right now. That's kind of gross right We can put these together. We can supply a Another argument to print we can give it name right there says hello there. What is your name? My name is John. It says hello there. It's nice to meet you John We can concatenate it on and Then add more Just like we have been doing with the data before we were string concatenating adding strings together It says hello there. What is your name? Hello there? It's nice to meet you John Now we can get more in depth with this. We can say what is your first name? Well now first name is what they're going to equal and We can ask what is your last name and then we can get input for that as well We can use last name as The variable we want to hold the value that is returned by raw input right, but we'll read in from us And raw input can actually take an argument inside these parentheses Inside of our function call We'll have an argument there We can say we can specify a prompt as a string say first name equals under the same thing For our last name and you know what let's let's try to build a little profile for whoever Actually interacting with let's have it say How old are you? And now we'll have another variable to hold this information for us right because you want to be able to keep track of it We want to be able to get a little bit more information display who they who they are right and age age can equal input because Right now we just want an integer right and it can of course take in another prompt there Then when we're done, we can have it print out Let's say it's all done now. Let's get a new line and Then let's concatenate on a Bunch of equal signs. Let's actually take one equal sign and multiply it by like 50 So it just looks like a this looks like a big string of equal signs, right? Because we can do that we can do that We can use that operator in Python to take one piece of data a string and multiply it just like we've been doing with numbers, right? And then we can print out the last name We can of course use a comma as in the argument to print statement or We can concatenate it on just like we were doing we kind of have an option there first name age So now we kind of have a little bit of output as to who this person really is Hey there. What's your first name John? Last name Hammond. How old are you? I'm 19 and then we get all that information right back out to us, right? Let's add another new line there and make it pretty and Here's an interesting thing Because we're passing in last name and first name as arguments to our print statement or function right now It doesn't have an issue but keep in mind age is an integer right now This age string that's prompting it and displaying it is a string If we were to concatenate this stuff It'll work with last name and first name because it's a string plus a string, right? This string plus our last name, which we know is a string variable This is raw input first name string first name string variable Age what's that going to do when it's a string plus an integer so we're just using input Let's try and run this first name John Last name Hammond age 19 Whoa, we get an error here trace back print age and age and this error is actually really good to us It tells us hey, I can't concatenate a string and an integer STR and int well We can we can just convert this data. Can't we? We're just it's just all data, right? Let's make this a STR We can wrap that in an STR, which is a function that will just cast this integer variable to a string All it is is a function. It's just a function call And now we've got a nice little profile report. Let's try and run this now John Hammond age 19 and it gives all my information out last name Hammond John 19 cool Simple demonstration, right simple simple stuff input and output and variables keeping track of the data Manipulating the data with operators. It's everything that we've already learned so far. It's all just coming together Is that is that cool? Is that cool with you because it's cool with me cool All right, thanks for being cool guys, and I'll see you in the next tutorial