Python Learning notes----python basics

Source: Internet
Author: User

Objective

Python version: 3.6.2

I. INPUT and OUTPUT

1. Output:

Use print () to output the specified content.

The content in parentheses can be a string:

Print ("hello,world")

can also be a comma "," separated by a number of strings, when the comma is encountered will output a space, the following output is: Hello World

Print ("Hello","World")

It can also be used as a mathematical formula to output the calculated results:

Print (12/5)

2. Enter

Input () can receive input from the user. It is important to note that the input () function in Python3 has all the inputs treated as strings, unlike in Python2.

str = input ()

Ii. Common data types

1.Number (digital)

Python3 supports Int,float,complex (plural), there is no limit to the number size in Python3

The complex number is made up of real and imaginary parts, which can be represented by a + BJ, or complex (a, b), and the real and imaginary part of the complex number are floating point types.

A, b, C = 0.1, 4+3jprint(type (a), type (b), type (c))
<class ' int ' > <class ' float ' > <class ' Complex ' >

2.String (String)

3.Boolean

Boolean values are calculated using And,or,not

3.List (list)

List is a mutable ordered set

4.Tuple (tuple)

Tuple is immutable ordered set

5.Set (Collection)

6.Dictionary (dictionary)

 

Python Learning notes----python basics

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.