Python Basics (3): Input output and operators

Source: Internet
Author: User

Tag: arithmetic operation print text. COM log hint information type input img

Summarize the most basic input and output and operators today

Input:

Python3 is all input ("")

Input ()

name = input () #输入的值会直接赋值给name

Name = input ("Please enter your name:") # ("") in the words to enter the prompt message

Ps:

The value you enter is assigned directly to name.

Input value is str type if you want to enter a value of a numeric type, you can: name = Int (input ()) Other types of input methods are identical.

Output:

Output the name value just now. (with text hint)

1. Print ("Name:", name)

2. Print ("Name:%s"%name) #% represents the placeholder s that is the character corresponding to the% following

A second way is recommended because you can control where the print is located.

Ps:

Operator:

Arithmetic operators:

Define two variables A = ten B = 20

Assignment operators:

Comparison operators:

Logical operators:

Python Basics (3): Input output and operators

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.