Python Study Notes 1: Python basics and python Study Notes

Source: Internet
Author: User

Python Study Notes 1: Python basics and python Study Notes
1. Variables and types
1 variable does not need to be declared


2 type (): queryable Data type


3 Data Type: None, int, float, bool, string


4 sequence: tuple-value table. The elements are immutable, list-table, and the elements are variable.
S1 = (1, 2.2, "3", True) # s1 is a tuple
S2 = [1, 2.2, "3", True] # s2 is a list
S3 = [1, [2.2, "3", True] # sequence is used as elem
Element reference
4.1 subscript reference: s [(int) index], subscript index starts from 0:
S1 [0] = 11
S3 [1] [zero] = 22.22


Reference in the 4.2 range: s [lower limit: Upper Limit: Step Size]
Lower limit omitted: traverse from the beginning
Omitted upper limit: to the end
If the upper limit is specified, the upper limit is not included.


4.3 tail reference: s [(int)-index], penultimate index Element




5 string
The string is a tuples and can be used to perform operations on the tuples.


6 operations
Mathematical operations: +,-, *,/, %, ** (multiplication)
Logical operation: = ,! =, <, <=,>,> =, And, or, not, in (determine whether an element is a sequence element)


7 indent
C language:
If (I> 0)
{
X = 1;
Y = 2;
}
Python:
If I> 0:
X = 1
Y = 2


3. Control Process
1. Select Structure
If-elif-else
If condition
Do
Elif condition
Do
Else
Do


2. Loop Structure (support for continue and break)
2.1 for-in traversal Sequence
For element in sequence


2.2 while
While condition:
Do


Four functions
Format:
Def functionName (args)
Do
Return args (multiple parameters can be returned)
I just learned Python and used Python30. I recommend a book for beginners.

The release of python3.0 is not long before. We recommend that you use more than 2.7, with less information and less answers to problems.
First look at the python simple tutorial, and then look at the python core programming.
After learning, you can easily develop a crawler tool. If you want to research the web, you can study django, which will make you excited!

This is my learning path.

I have always been helpful!

Question 1: How familiar is Python? Schools with no foundation ② recommended for learning Python are preferably Beijing

1. It is relatively difficult to learn. However, it is not easy to learn well.

2. I don't know. Recommended.
I just want to say that I have written a lot of tutorials.
It is easier to get started.
For example:
[Arrangement] Introduction to Python
Understand what python is.

[Arrangement] [Multi-graph explanation] How to Develop Python in Windows: Running Python scripts in cmd + how to use Python Shell (command line mode and GUI mode) + how to use Python IDE
Understand how to write python code and run python code.

3. You can refer to my:
[Arrangement] how to learn Python + how to effectively use Python-related network resources + how to use Python Manual)
It will teach you how to learn Python and promote books suitable for getting started.

(No post address is provided here. Please search for the title on google to find the post address)

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.