Hey, welcome back to another article on python basics. If you haven't seen my previous posts, read them before this one. You actually have to unless you already have an Integrated development environment (IDE). This is post #2. In this lesson, I'll be showing you how to use integers, strings, floats, and booleans. Also, I'll show you the print statement so you can use them. First up, I will be showing you strings.
Strings are basically just something in quotes. So "HELLO" is a string, "I am a god" is a string, even "jdhskljfhf shnfcljk" is a string. Strings are very useful when you are telling the user something, or whatever you see in the picture above (guessing game I made, not the whole thing). Also, by quotes, I mean "double quotes" or 'single quotes'. So that basically sums up my explanation on strings. Onto the next one! In Idle, if you see something green, it is a string.
Next up is the integer. An integer is just a whole number. Like 1 is an integer, 2 in an integer, 9821730987409827094273912837409127490170928743 is an integer. Now, remember how I said anything in quotes is a string, I meant ANYTHING. "123" looks like an integer because it is a whole number, but it is in quotes, so it's a string. Integers are also useful in python because you can do calculations with them, show the number of something the user asks, and more. I used Integers in the guessing game I made, lots of them. That is my explanation on integers, and we're moving on to our next subject now.
Our next subject is floats. Floats are decimals. Any number with .SOME RANDOM NUMBER(S) is a float. For example, 9.8 or 2.65 in a float because they are decimals. Now, if you don't know what decimals are, I really can't help, I'm not the math teacher here! But there is a catch like the integers. 9.0 looks like it should be an integer because it equals 9, but anything with a point and a number is a float, even 0. Also, anything with just a number than a point is a float too. Like 1. is a float, 903409128304982134013. is a float. Floats can be used to show amounts of money, fractions, and more. Strings and integers are more popular, but floats are used a lot also. Now we will be moving on to our next subject, booleans.




Comments
Post a Comment