Variables-Data types-objects-how to write Python scripts

Source: Internet
Author: User

Naming rules for identifiers
Variables are examples of identifiers. An identifier is a name used to identify something. When naming identifiers, you should follow these rules:
the first character of an identifier must be a letter in the alphabet (uppercase or lowercase) or an underscore (' _ ').
other parts of the identifier name can consist of a letter (uppercase or lowercase), an underscore (' _ '), or a number (0-9).
The identifier name is case-sensitive. For example, MyName and myname are not an identifier. Note that the former lowercase n and
the latter in uppercase N.
Examples of valid identifier names are I, __my_name, name_23, and A1B2_C3.
examples of invalid identifier names are 2things, this was spaced out, and My-name
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

variable can handle different types of values, called data types. The basic types are numbers and strings, and we've talked about them. In the later chapters of
, we will look at how to create our own types using classes.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

object
Remember that Python calls anything that is used in a program as an object
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Comments to object-oriented programming users
Python is extremely completely object-oriented to
objects, including numbers, strings, and even functions.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
How to write a python program
The following are standard procedures for saving and running Python programs.
1. Open your favorite editor.
2. Enter the program code in the example.
3. Save it as a file with the file name given in the note. I follow the convention of saving all Python programs with the
extension. py.
4. Run the interpreter command Python program.py or use the idle run program. You can also use an executable method that was previously referred to as
.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
An example of
using variables and literal constants

#  Filename:var.pyi = 5print= i + 1print"This isa multi-line String. The second line. " " Print S



Variables-Data types-objects-how to write Python scripts

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.