 Hey, what's up everybody my name is John Hammond and welcome back to another YouTube video and tutorial We're still looking at the basics of Python in the last video We just made a real simple hello world program I got to take a look at comments and stuff in the Python syntax and that's awesome We're moving right along we're gonna take a look at data types like simple literal constant data in our last video since we just displayed and sent it to a center standard output Hello world we did that with a string and I'm just gonna save a new script for us I'll call it data types dot pi and Let's take a look at all the other options for data types. I'm just gonna make all of these comments I did that with control plus in sublime text and we've got strings that we're working with and strings are just like letters or text or paragraphs or any kind of information that we're representing by Text and information hello world right now is a prime example of that and we're denoting that in Python syntax with these Double quotations double quote marks. Hello world and that is a string Equal sign we can do that same thing with a single quote This is also a string and that's just information held in this string right here I can print that out just as before We run this and it says this is also a string Because that's that's it's just that it's just that easy. It's easy. It's easily letters text information Strings are really just multiple characters and character can just be a single letter normally that's then that's that's what's normally denoted by a Single quotation mark right here, and that's just a or B or C or D, but it's just one of them That's kind of just one character strings are multiple characters just put together Like since strings are multiple characters put together, we can index them at individual characters Right now if we're setting string to equal hello world if I were to take a look at string dot I'm indexing with these braces here zero that should return a single character H computers are zero base, so we're counting with zero that will be the first index the first letter or portion or character of that string String one would be the second that would be E and Then etc etc 2 would be L etc etc. You can index them just like that and get the individual characters out of them simple stuff There is of course numbers though. There are also numbers that we're working with as literal data and Those can be for one thing integers and integers are Integers they range like from negative infinity to positive infinity and they include zero, but they're always whole numbers Zero one etc etc, but it's not a fraction. It's not a decimal. It's always a whole number just like that Floats are what they call anything else that actually is a fraction or a decimal like negative 3.14 or 3.4 or 2.0 or 3.4. Oh my gosh 2.4 etc etc. They can have Any other amount of decimals as they would want we can print those out as well Let's just take this guy Print him out run it with control B, and it's just printed out just fine. We're just getting that centered output and displaying that data Since these are numbers that we can work with we can obviously do things with them as well Just operate on this data if you wanted to just like math you add Subtract multiply and divide and it's interesting though when we do that I Can say 3 plus 4 good and that gives me 7 I can say 3 minus 4 and that gives me negative 1 3 times 4 that works just fine. We get 12, but if I do 3 divided by 4 I get 0 But we know that it's not really 0 Why is that normally it should be like like you know 3 4ths it should be a fraction But why is Python telling us it's 0? Well, that's because We're using integers to do this math So Python is going to give us an integer back if we gave it 3.0 or 4.0. It tells us oh, it's 3 4 So it's 0.75 the actual decimal value there's also another operator which is the 2 Division signs which that's just floor division so it'll round down I think 3.0. Oh and That'll round down rather than giving us 0.75. It'll round that decimal down to just straight 0.0 Pretty much it we can operate on data not just with numbers though. We can still have strings that work in a multiplication and stuff like we can say John 10 times and we get John John John John We can add strings together like John plus Hammond get my name and now it displays John Hammond cool it's interesting though Because because strings are denoted in this way with single quotes or double quotes anyway like that If I use single quotes inside double quotes, they'll be represented correctly if I use Double quotes inside single quotes. They'll be represented correctly I'll do just the ham in the string Now they're represented correctly But what if I wanted to have double quotes inside of double quotes? What if for whatever reason I was having Python like display stuff from a book? right now It's not actually going to be able to Display that like if I wanted to have dialogue if I wanted to say John had said Hello world It's gonna give me an error Because you can even see my syntax hiding is going like freaking out because It's not able to figure out what string really starts where Because we're using these double quotes inside of double quotes Python is going to interpret these as the end of the string So we can get around that we can actually escape these quotation marks that we actually want inside of our string Or inside of our output right now. We do that with a backslash character backslashes will escape certain characters in This case we'll use it on our quotation marks So now when we print this out John had said hello world. We're able to see those quotation marks just fine Well, what if we wanted to actually use a backslash character in our string though? We can escape that This is a backslash and then a backslash backslash will now print out the backslash for us We can also get a new line backslash and Backslash and we'll give us a new line Backslash backslash to get a backslash backslash T We'll get us a tab character. So now this is further forward just like a tab character in sublime text or Any other text and that's pretty much it. You can look more of these up in Like online obviously we wanted to do Python escape characters There's some information on it and you see they're doing the same thing we were doing with these backslashes and Here's a whole chart of them you can get the double quotes single quotes just like we saw earlier the new line Tab character vertical tabs etc. Etc. That's pretty much it though That's data you got strings numbers And we can add them together. We can do operations on them etc. Etc. So cool. Thank you guys for watching Hope you enjoyed this. I know it's real simple stuff I'm just trying to crank out the basics, but it's got to get done So thanks for watching again, and I'll see you in the next tutorial