3. Python variables

Source: Internet
Author: User

1, the variable Understanding (1) variable is a point to address the


>>> x=12>>> ID (x)3735132>>> y=x>>> ID (x)3735132

For variable x and variable y, their IDs are the same, that is, the variable is pointing to the address.

Memory holds the contents of x=12, x equals this value, that is, X points to this address and y = x, then y also points to this address. In other words, a variable, in fact, is similar to a pointer, although it is an assignment, but in fact is the pointer to the problem, and does not modify the current address of the saved content.

(2) Variable does not need to specify data type

>>> x=12>>> y=12.5>>> type (x)'int'>>>> type (y) ' float '>>>> z="qxj511">>> type (z)' Str '>

When initializing, you can use it directly, what type of assignment are you, what type,

3. Python 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.