The path to learning in Python-day1

Source: Internet
Author: User

1.python2.x and python3.x selection

Select Python3. X, the reason is official against Python2. The development of X has entered the school-level state, and the support time for python2.7 has only been extended to 2020 years.
For beginners, it is recommended to learn Python3 directly, because Python3 represents the future of Python development, the current mainstream library has basically supported Python3, unsupported libraries are actively want to python3.x migration

Installation of 2.python

This is only a description of the Python installed by default under Windows installation Python,linux system

1) 下载安装包,https://www.python.org/downloads/

    2)双击安装即可,记住python安装的目录
3) Configure Environment variables right-click Computer-"Properties-" Advanced system Settings-"environment variable
In the system variable, find a line named path, double-click at the end and add "; Path". If the path you installed is: C:\Program Files (x86) \python36, add to Path:; C:\Program Files (x86) \google (remember not to forget the semicolon in front of the path) 4) when the installation is complete, open the console (Windows+r shortcut key startup), enter Python to view the Python version, and Writing the program below, I wrote a small program to print Hello World 3. I found a good software--pycharm, use it to write code very convenient 4. In fact, Python syntax, type and C,c++,java similar, here will not repeat the 5. Comments
When line comment: #print ("This is a single-line comment! ") Multiline Comment: There are two ways: 1) Three pairs of single quotes, 2) Three pairs of double quotes ' print (" This is a multiline comment! ") Print (" This is a multi-line comment!) ")" "Print (" This is a multiline comment!) ") Print (" This is a multi-line comment!) ”)     ‘’‘’‘’

6. A T special Assignment method: The contents of the note are assigned to the MSG, the contents of the note do not operate

 

7. User input

Username = input ("Username:")

Password = input ("Password:")

Print (Username,password)

The operating result is:

8. Print the data type of the variable

Age = 10

Print (Type (age))

Operation Result:

Variables declared in Python are of type string by default and need to be cast: age = Int (input ("Age:"))

9.if else (subsequent updates ....) )

The path to learning in Python-day1

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.