 Okay, welcome to lesson four of Python for Java programmers in this lesson We're going to be talking about integers doubles and bullions as they call as they are called in the Java world But in the Python world, they are called integers floats and bullions So a little bit of a difference there. So let's take a look as you know in Java You must declare your type for your variable if you don't declare it. It doesn't exist doesn't work Yeah, you got to say this isn't it. This is double. This is a Boolean in Python You do not have to do this Python is smart enough to know that if I say I equals 20. I know it's an integer If I say X equals 6.0, I know X is a float in the Python world Booleans now, this is a little different is tired equals true True so notice here The Java convention for variable naming is called camel casing So we have start with a lowercase letter each word boundary. We have a capital letter Notice also that true is not capitalized, but in Python it is in Python the variable naming convention is called snake casing. So it's like a snake It's always lower the ground. So when you have a a word Boundary you put it underscore Get functions the same But if you do this in Python, it looks a little bit weird if you do this in Java It looks weird people will think you are strange. So let's go ahead and print those out so I can print I I can print X And go ahead and run that and see if we get the same output So so far so good 20 and 6.0. So there's a couple little differences here So let's kind of scroll down here and take a look at the next section And again, I hope you're seeing the commonalities amongst the programming languages there are only so many computer programming concepts and High-level languages kind of tend to follow the same kind of basic ideas So I'm gonna head and print a blank line I'm gonna go ahead and print just as a reminder I plus X I plus X in quotation marks will print out the literal I plus X. I'm gonna go ahead and print I Plus X I'm gonna print See I minus X and we'll see what happens print I times X notice. It's the exact same symbols divided by X And then finally I did a little bit dip something different here five percent four for the modulus Let's go ahead and run that and see if we get the same answers or something different So I plus X twenty six point zero fourteen point zero one twenty three point three three repeating and one So essentially the basic math functions are all the same we get the same results One thing if you are if you were noticing here to say is that even though we had an int and a double It was converted to sorry an int in a float It was converted to a float as well here now if you're using Python to what you shouldn't be because it's end of life You might see a slightly different result when doing integer division, but hopefully you won't run into that problem Now this is where it gets a little bit more interesting print blank space so print and I put it here X is Plus X and I'm just gonna go ahead and run that and see what happens Okay, this is one of those weird very excited to say very rare cases where Java is actually better I think than Python in that Java will automatically convert this integer Or is this a double? This is a double automatically convert this double into a string when you print it It's very nice to them to do that for you Python does not I don't know why it's it's a really weird thing. I'm sure there's a good reason for it So it tells you can only concatenate string str mean string not float So we know that X is a float because it's 6.0. We didn't have to put float here We didn't have to put int here or Boolean the computer just says, okay, that's what it is now To do this what I can do is str So this is the way that we I guess basically we call it casting This is how we cast in Python We put the type that we want it to be we put it inside of parentheses and Then it audit then it converts it to a string for us and Then X is 6.0 notice just real quick. It doesn't actually change X into a string Just locally here it converts it to a string for us then concatenates it combines it with X is and then that prints out The result X is still a float, but in this local case here. It returns a String for us so we can print it out. You'll turn to that is This print X is it's very similar to what we have over here in Java and we saw this in I think in the the first or second video, whichever one it was Format and I want to put X And over here I need to put Curly braces and now this format automatically converts it into a string for us as well So we get the same output as we see there Interesting, huh? And then finally just to kind of roll this out print is Tired and we'll go ahead and run that and see what happens and we get true notice again small tea big tea Which is really interesting. I'm not sure why that's a capital T over here It's a bit of an inconsistency in Python, but again, I'm sure there is a very good reason now so far I think it looks pretty straightforward, but here's one really really really big difference between Python and Java so if I tried this if I try to say let's say Say I equals Let's say Tokyo a tech and then system out that print L n I I Okay, hopefully you know what's going to happen here So we have an error string cannot be converted to int So we've taken we're trying to take a string put it into an int container and we get an error This is just not possible with Java Java is what we call strongly typed once a variable is declared as a certain type It is pretty much that type unless you I guess you let's I don't know if you could redeclare it I never really thought about trying it, but you know That's super not super concerned about it right now Now in Python if I did this I equals Tokyo EdTech print I And I run it It works So in Python you can change a variables type on the fly Okay, so I'm done with that. I I don't need this integer anymore Yeah, I'll just change it to a string and call it Tokyo EdTech You can do that in Python It makes coding a little bit, you know easier in some cases a little bit more convenient a little less typing a little less syntax But as you can probably imagine if you've done a lot of Java programming You'll you'll end up seeing a lot of errors where you're sending a string and it's supposed to be an integer Or you're sending an int supposed to be a string and all these kinds of different issues Okay, so but this is something that you can do so I'm putting here Python is weekly tight Okay, so we can go ahead and change the type. I think it's called weekly I hope I get the right wrong vocabulary word there. Anyway, that is that. Thanks for tuning in stick around for more