Python: annotation, python Annotation

Source: Internet
Author: User

Python: annotation, python Annotation

What is annotation?

Logout: not executed

Code explanation: Some people are used to putting the code explanation on the edge. We suggest putting it on top.

1) A single line comment starts #

#Requirement 12: enter a positive integer n on the keyboard, find the sum of n and its reverse order, and output an example: 123 Reverse Order 321 output 123 + 321 =?

Uncomment a single row: Ctrl +/

 

2) Multi-line comments tell you the role of this module for better readability; you can use multiple # numbers, as well as ''' and """:

For example:

"""

#Requirement 12: enter a positive integer n on the keyboard, find the sum of n and its reverse order, and output an example: 123 Reverse Order 321 output 123 + 321 =?

Num = input ("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 )))

"""

Unregister multiple lines, select multiple lines of code, and then press Ctrl +/to cancel multiple lines.

 

3) Other

#-*-Coding: UTF-8-*-indicates the encoding used.

#! /Usr/bin/python3 code written in Linux, not required for windows

#! /D:/python/python.exe code written in Windows.

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.