In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "what is the use of variables and punctuation marks in python". In daily operation, I believe that many people have doubts about the use of variables and punctuation marks in python. The editor consulted all kinds of data and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "what is the use of variables and punctuation marks in python?" Next, please follow the editor to study!
Variable 1, naming rules for identifiers
In Python, the name of a variable, function, or class is called an identifier.
Identifiers are made up of letters, numbers, and underscores, are case-sensitive and cannot start with a number.
The user-defined identifier cannot be the same as the Python keyword or internal function, or an error may occur.
2, basic data types
3, the variable as the label
Compared with many programming languages such as C, the variable of Python, as a dynamic language, is a label, not a container.
So the same variable name can point to different data types, and renaming a variable is equivalent to changing the direction of the label.
Second, commonly used punctuation mark 1, indented by four spaces
Python does not use curly braces or end keywords to control the code scope of judgments, loops, functions, and classes
Instead, you use indentation to implement code grouping. It is usually indented with four spaces.
2. Comment in'#'or three quotation marks
3, slash'\'as multiline connector
4, semicolon';'to implement multiple statements on a single line
The role of other punctuation marks will be learned later in the learning process.
Third, thinking practice
5. Observe the following code to summarize how string types and integer types are converted into Boolean variable types.
(reply keyword python05 for reference answer)
6. Observe the following code and compare the differences among single quotation marks, double quotation marks and three quotation marks.
(reply keyword python06 for reference answer)
At this point, the study on "what is the use of variables and punctuation in python" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.