In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the input, output and identifier of Python. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.
I. Identifier
What is an identifier?
An identifier is a symbol used to identify an entity. In a programming language, an identifier is a collection of valid strings as names in a computer language. Identifiers are names that users use when programming. Variables, constants, functions, and statement blocks also have names, and their names become identifiers.
Considerations for identifiers:
1. It consists of numbers, letters, and underscores, and cannot start with a number. The code is as follows:
1_username = 'Lisi' # identifiers that start with a number will directly report an error
two。 Strictly case-sensitive
Name = 'Ander Li will report an error directly if you hit the code print (Name) #
3. Cannot use keywords-words with special meanings: if / for / while / else, etc.
4. Cannot use keyword as variable name
5. To achieve as the name implies
Name = 'Zhang San' # name age = 19 # age weight = 80 # body weight print (name,age,weight) naming should be standardized:
Small hump nomenclature: the first letter is lowercase, the rest is uppercase = > (userNameAndPassword)
Great hump nomenclature: the first letter of each word is capitalized = > (PersonModel)
Connect with an underscore: user_name_and_password
There are two points to pay attention to:
Variables, functions, and module names in Python are connected with underscores
Class names in Python use the big hump nomenclature.
II. Input (input)
1.input () write the prompt message in parentheses
two。 Define a variable to hold what the user enters
3. No matter what the user enters, the result saved by the variable is a string
4.Python uses input built-in functions to accept user input
5. Note: strings cannot be added to numbers (integers), otherwise an error will be reported
3. Print (output)
What kind of character division is used for each value when the sep parameter is used to indicate the output? space is used as the delimiter by default.
Sep='',: a space in the middle (for example: print ('hello','good','yes','hi',sep='+')
After end executes a print statement, the next characters to be output default\ nrepresent line breaks
Print ('hello','good','yes','hi',end= "-") on the input, output and identifiers of Python is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.