Python-Introduction Course 3

This article mainly introduces some commonly used functions to pave the way for python teaching in the future, otherwise it will be bad if I don't know what I'm talking about in the future.

Before the beginning of the text, let me say a few more words. To learn a skill well, you must practice, read, search, learn, use, search, find, and ask. Therefore, I don’t need to talk about the importance of practice, everyone. You can taste it yourself.

Python commonly used functions:

- Output function: print (variable name + "string")

---------Do not add double quotes or single quotes in the "variable name". For example, if you assign 3 to a, that is, "a=3", you only need to print (a) to output the value of a. To output a is 3, you need print("a is", a)

--Input function: input("")

----------The input function is a very important function in Python. The main function is to input. In the previous example, we assigned the value of a to 3. This is what we wrote in the program. Cannot be changed, only the programmer can change, so if you want the user to interact with the program, you only need a=input("Please enter the value of a:"). The running result of this line of code is "Please enter the value of a:" If you enter 3, the value of a is 3, and 4, the value of a is 4.

--for i in range(a):

----------Execute a cycle

--

 

Guess you like

Origin blog.csdn.net/Hsk_03/article/details/106325021