Python Learning note 10 (User interaction Program)

Source: Internet
Author: User

Comments

Single line: #

Multiple lines: 3 consecutive single or double quotes on top and bottom

3 Quotes In addition to multiple lines of comment, you can also print more than one line

Example:

msg = name = (name) (msg)

Running the result the second print is printing 3 lines of string.

If a single line, use quotation marks: msg = "Alex Li"


In Python, single and double quotes are the same, except for single sets of double or double sets.

Example: Msg = "I ' m Alex Li"


User input

Example:

= () password = () (, password)


Formatted output

%s (string), the difference between%d,%f

Print the data type of the variable: print (type (variable name))


RAW_INTPU Python 2.x

Input Python 3.x

Python2, it is recommended to use the Raw_input, if you use input, you need to enter the value of the string variable when the "" quote.


Classroom Exercises:

This article is from the "Tread Footprints" blog, please be sure to keep this source http://zoucuo.blog.51cto.com/962798/1885563

Python Learning note 10 (User interaction Program)

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.