1. Time complexity (large o notation):O (1) O (logn) O (2n) O (n!) O (NN) (1) Time complexity of commonly used data structures in Python:The time complexity of the list built-in operations: Dict time complexity for built-in operations:
A. While loop:While condition:code block (Loop)Execution process: 1. Determine if the condition is true, if true, execute the code block2. Again to determine whether the condition is true ...3. If the condition changes, jump out of the loop. End
Recursive
Invoking the behavior of the function itself
Have a correct return condition
def factorial (n):if n = = 1:Return 1Elsereturn n * Factorial (n-1)Number = Int (input (' Please enter a positive integer: '))result = factorial
python Environment:To install Python: Pyrhon installed on the OS, To perform the operation: write a file, the file in accordance with the rules of Python, the file to the Python software, read the contents of the file, then convert and execute, and
NO1:"Pillow" Image processing Standard libraryScaling fromPILImportImage#open a JPG image file, note the current path:im = Image.open ('test.jpg')#Get image size:W, h =im.sizePrint('Original image size:%sx%s'%(W, h))#Zoom to 50%:Im.thumbnail (W//2,
Today's content:1. Properties2. Class methods3. Static methods4. Reflection1. Propertiesrefers to the invocation of a function in a class as if it were a call to an object property value. More Authoritative Solutions Interpretation: masquerading a
Python sequence table Learn a bit, data structure and algorithm, do a summary. If it's not right there, please give me more advice.Sequential tables , in which elements are stored sequentially in a contiguous storage area, the order relationships
Dictionary traversal is the traversal of key, and the order of key selection is unordered:def print_hist (h): For C in H:print C, H[c]Dict reverse lookup and throws an exception:def reverse_lookup (d, v): for K in d:if d[k] = = V:return k raise
One, while loop, the use of continue, break statements in a while loop1. While loop statement:While condition:code blockExecution process: Determine whether the condition is true, if true, execute the code block, continue the next cycle, continue to
>>> Dict1 = {' A ': ' 1 ', ' B ': ' 2 ', ' C ': ' 3 ', ' d ': ' 4 '}>>> print (' A's value is: ', dict1[' a '])The value of a is: 1>>> Dict4 = dict (' I ' = ' happy ', you = ' sadness ')Syntaxerror:keyword can ' t be an expression>>> dict4[' you '] =
Co-process: Also known as micro-threading, English name Coroutine.Function: It has its own register context and stack, can keep the state of the last call, can pause the program at any time, switch back at any time.Advantages:Without the overhead of
Co-process: Also known as micro-threading, English name Coroutine.Function: It has its own register context and stack, can keep the state of the last call, can pause the program at any time, switch back at any time.Advantages:Without the overhead of
Python is omnipotent, learning Python, a summer vacation is enough!!Getting started with Python, the best way to play from a hacker is the simplest!!Recommend a book today "11 Tricks to play network security-with Python, more secure"
Network
Method One:Derivation formuladd="ewq4aewtasddsfdtfdswqrtewtyufashas"print for in DD}Method Two:CounterImport COLLECTIONSDD="ewq4aewtasddsfdtfdswqrtewtyufashas"= Collections. Counter (DD)print objMethod Three:Similar to the method
The function calls itself inside itselfThe wireless loop will be error-free, so a definite end condition is requireddef Calc (n): Print (n) calc (n) Calc (10)def Calc (n): Print (n) if int (N/2) = = 0 :return nreturn calc
One, while loop1. Cycle. While loop While condition: code block (loop body) Execution process: 1. Determine if the condition is true. If it's true. Execute code block 2. Again to determine whether the condition is true ...
Before we learned about str, int, float and other data types, such as the name of the Str,name= ' rookie ', then if we a department? Do you also store data in strings? Names = ' Rookie, Zhang San, John Doe ' so save the data, in the call is not very
1 #-*-coding:utf-8-*-2 3 #random use of various methods4 ImportRandom5 6 #random generation of floating-point numbers [0.1]7 Print("random ():", Random.random ())8 9 #randomly generates an integer between 1000-9999Ten Print("Randint (9999):",
the person who touches the investment will hear more or less: the certificate100, the certificate200, Shanghai and Shenzhen300, the certificate500, the certificate700, the certificate800, the certificate1000These financial abbreviations ... But in
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