Complete the output of the Python "Hello World"

Source: Internet
Author: User

Variable declaration

1 # -*-coding:utf-8-*- 2 3  " Brain Yang "

The code above declares a variable named: Name, and the value of the variable name is: "Brain Yang", and here's a talk about each line

# -*-coding:utf-8-*-

Declaring character encoding set: In order to display the Chinese declaration character set Utf-8,python 2.x be sure to declare that Python 3.x defaults to UTF-8 can not be declared.

" Brain Yang "  #  declaring variable name

The declaration variable declares a variable named: Name, the value of the variable name is: "Brain Yang", the variable type is a string, and is identified by a single quotation mark ( ‘...‘ ) or double quotation mark ( "..." ). The naming conventions for variables are as follows.

rules for variable definitions:

        • Variable names can only be any combination of letters, numbers, or underscores
        • The first character of a variable name cannot be a number
        • The following keywords cannot be declared as variable names
          [' and ', ' as ', ' assert ', ' Break ', ' class ', ' Continue ', ' Def ', ' del ', ' elif ', ' Else ', ' except ', ' exec ', ' finally ', ' for ', ' F ' Rom ', ' Global ', ' if ', ' import ', ' in ', ' was ', ' lambda ', ' not ', ' or ', ' pass ', ' print ', ' raise ', ' return ', ' try ', ' while ', ' WI Th ', ' yield ']

Assigning values to variables

1Name ="Alex Li"2  3Name2 =name4 Print(name,name2)5  6Name ="Jack"7  8 Print("What's the value of name2 now?")

 

Complete the output of the Python "Hello World"

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.