Python: Comments

Source: Internet
Author: User

What is a comment?

Logout: Do not participate in execution

Explanation Code: Someone is used to explaining the code on the edge, suggesting that it be put on top.

1 ) A single line comment begins with #

# Requirement 12: Keyboard input positive integer n, to find the sum of N and its reverse order and output for example: 123 reverse order 321 output 123+321=?

Single-line uncomment: Ctrl +/

2 multiple lines of comment, which tells you the function of the module, has better readability, can use multiple # numbers, and "and" ":

Such as:

"""

# Requirement 12: Keyboard input positive integer n, to find the sum of N and its reverse order and output for example: 123 reverse order 321 output 123+321=?

num=input (" Please enter a number:")

New_num= ""

I=len (num)

Whilei>=1:

NEW_NUM+=NUM[I-1]

I-=1

Print ("%d+%d=%d"% (int (num), int (new_num), int (num) +int (new_num)))

"""

Multi-line logout, select multiple lines of code and CTRL +/to cancel multiple lines

3 ) Other

#-*-coding:utf-8-*-tells the type of code used

#!/usr/bin/python3 code written under Linux, Windows does not have to write

#! /d:/python/python.exe write code in Windows, can not write

Python: Comments

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.