The kitchen is set up, we're going to start cooking!

       In the previous article, we have installed python and configured the environment variables, that is to say, our kitchen has been set up, and then it is time to cook.

First, let me talk about how to open Python? It is the penultimate step in the previous article, enter cmd in the menu search box, press Enter, a black box will pop up (this black box is called the command run box), then enter python in the black box, press Enter, You will see the "<<<" symbol, yes, you have entered the world of python.

                                                             

 

The following paragraph is nonsense, if you are interested, read it, if you are not interested, skip it:

       Next, I want to tell you the basics, that is, how to wash vegetables and how to cut fish. You may have heard of the position of algorithm engineer, so what is this probably for? This post is probably thinking about whether to put salt first or put MSG first when cooking and stir-frying. Do you feel speechless, put salt first? Or MSG? Is there a difference? Well, many things in life seem to be the same, but if the order is right, you can increase efficiency, like drinking tea, you boil the water first, and then while the water is not boiling, is it ok? Carefully select the tea leaves, and then put the tea leaves into the teapot to save time. This process is similar to the algorithm. If you write the program reasonably, the program will occupy less resources, the computer will not be stuck, the running time will be fast, and the user experience will be so good!

                                                    

 

        Ok, let’s not talk nonsense next (please remember that your input method is switched to English, but the computer does not recognize Chinese, including Chinese commas, etc.) :

In Python, the operation symbols (addition, subtraction, multiplication and division) are similar to what we usually use. Multiplication is the symbol "*", and division is the symbol "/". If you type an extra slash " // ", then Indicates the integer quotient, for example, 5 // 2.4 The result is 2; the signs of addition and subtraction are still "+" "-".

       Well, that's right, I've finished talking nonsense today. Next, I'm going to popularize the flower in the previous article:

       Did it feel amazing? Hahaha, no right?

       OK, look at the code of the flower, is the first sentence import turtle; import means import, turtle is a package of python, a package for drawing, you can think of it as a drawing board, with This drawing board, you can draw, and can you guess what the other codes below mean? bingo! Just tell the computer how to draw. The whole code is so simple, nothing else.

Well, I'm going to go back to the no-nonsense channel again, that is, you try the five operators, then try one with an integer and the other with a decimal, and the final result is an integer or a decimal (for example, the result is 2, Do you try when you will get 2, when will you get 2.0, when will you get 2.00?)

(If the pictures in the article are infringing, please contact the author to delete them)

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325209196&siteId=291194637