Python Basics-Variables

Source: Internet
Author: User
1. What is a variable?
Variables are memory addresses that can be accessed through variable names, and variables are usually mutable.

2, how to define?
Variable format:
Variable name = "Variable Value"
For example:
  
" ZHANGHK "
Note: The variable name points to an address in memory, the variable name in the example, which is actually pointing to the place where the memory address is "ZHANGHK"
3. What are the requirements for the name of the variable?
Naming rules:
  • Variable names can only be any combination of letters, numbers, or underscores
  • The first character of a variable name cannot be a number
  • The system reserved keywords cannot be used
  • You should use a concise and meaningful variable name
  • Usually using the Hump naming method, Hungarian nomenclature, etc., it is recommended to use the underscore method, example: Ip_master = "10.0.0.5"
  • If it is a constant, all characters need to be capitalized, for example: PIE = 3.14

Python Basics-Variables

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.