A brief talk on-python input, output, operator, data type conversion

Source: Internet
Author: User
Tags arithmetic operators

Output:

Formatted output:
    

See the% such operator, which is the formatted output in Python.
    

Line break output:
At the time of the output, if there is \ n, then the contents of \ n will be displayed on another line

Input:

In python2.7, use: Raw_input (), not available in Python3. Python3 only input ()

    

Input () in Python2 as a formula (character) for what the user has entered. So in the Python2 generally with raw_input ()

    

The input in Python3 is the same as the Raw_input () function in Python2

Operator:

  Python supports the following types of operators

1. Arithmetic operators:

The following is calculated using a=10, b=20 as an example

  

2. Compound assignment Operator:

  

Common types of data conversions

To force type conversions:

  

A brief talk on-python input, output, operator, data type conversion

Related Article

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.