In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces how to use variables and identifiers in Python, the content is very detailed, interested friends can refer to, I hope it can be helpful to you.
Code implementation
A = 10
A = 'hello'
Print (a) # output hello
_ b123 = 20
Print (_ b123) # output 20
# print = 123
# print (print) # keyword variable output error
Code run output:
Hello
twenty
Program analysis
Variables:
# you cannot use variables that have not been assigned
# if you use a variable that has not been assigned, you will get an error NameError: name 'b'is not defined
# Python is a dynamically typed language, which can assign any type of value to a variable or modify the value of a variable at will
Identifier:
# all content that can be named independently in Python belongs to identifiers # for example: variable names, function names, class names # identifiers must follow the specification of identifiers. Identifiers can contain letters, numbers, and _, but cannot start with a number # example: aqum1 _ A1 _ 1a2. Identifiers cannot be keywords and reserved words in Python and it is not recommended to use function names in Python as identifiers, as this will cause the function to be overwritten by 3. 0. Naming conventions: # follow two naming conventions in Python: # underscore nomenclature # all letters are lowercase, use _ segmentation # max_length min_length hello_world xxx_yyy_zzz# Pascal nomenclature (big hump nomenclature) # the first letter is capitalized, and the first letter of each word is capitalized If the rest of the lowercase # MaxLength MinLength HelloWorld XxxYyyZzz# uses substandard identifiers, it will report an error SyntaxError: invalid syntax is here about how to use variables and identifiers in Python. I hope the above can be helpful to you and you can learn more. 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.