Topic from Project Euler 14th: https://projecteuler.net/problem=14"Project Euler:problem 14:longest Collatz sequencethe following iterative sequence are defined for the set of positive INTEGERS:N→N/2 (n is even) n→3n + 1 (n was odd) Using the rule
One, for loopThe For loop is a very common loop in our programming, and here are some examples of applications for loops in Python:1. Single-layer for loop#!/usr/bin/env Python3#-*-Coding:utf-8-*-#user: Slim_liuFor I in range: #循环10次Print (i)
Integer and Boolean type
Gets the data type of the object
1. Type ()
2. Dir ()
3. Help ()
4, in the pycharm inside the operation
numeric type int
Create:
Int ()
Use Python to test the availability of a set of URLs in bulk (which can include HTTP status, response time, and so on) and count the number and frequency of unavailable situations.Similarly, such a script can determine the availability of a service
This script can be used to count the number of connected IPs on a port, and to count all IPs connected to that end, the maximum number of IPs and times, and the status of the TCP connection.Involves Python reading network connection statistics and
In object-oriented programming, exposed data members can be freely accessed and modified externally, which makes it difficult to control the legality of user's modification of the newly-updated data. A common way to solve this problem is to define
@property can access a Python-defined function as a property, providing a more friendly way to access it, but sometimes setter/getter is needed, why is it necessary to use functions as attributes?First, in order to provide friendly access, the
Python's Calling functionPython has built in a lot of useful functions that we can call directly.To invoke a function, you need to know the name and parameters of the function , such as an absolute function abs, which receives a parameter.
First, this is Python.For I in range (1): print ("". Join (["%d*%d=%d"% (j, I, I*j) for J in range (1, i+1)]))DetailedFor I in range (1): #当i = = 1 O'Clock: print ("". Join (["%d*%d=%d"% (j, I, I*j) for J in range (1, i+1)])) a ["%d*%d=%d"
English documents:
delattr
( object , name )
This is a relative of
setattr () . The arguments is an object and a string. The string must be the name of the one of the object ' s attributes.
The OS module provides new/delete/view file properties for directories or files, as well as path operations for files and directories. For example: absolute path, parent directory ...OS.SEP can replace the operating system-specific path delimiter. "\
filter, map, and reduce are all processed on a set, filter is easy to understand for filtering, map is used for mapping, and reduce is used for merging. Is the Python list method of three carriages.1. The function of the filter function corresponds
This plugin makes it easy to see many things, including HTML.
Open the Watercress Movie Leaderboard top250 page, found that each page has 25 movies, altogether 10 pages, each page URL has the following characteristics:
Http://movie.douban.com/top250
English documents:
Help ([Object])
Invoke the built-in Help system. (This function is intended-interactive use.) If no argument is given, the interactive Help system starts on the interpreter console. If The argument is a string and then the string
1. Functional Programming1) conceptFunctional programming is a programming model that considers computer operations to be calculations of functions in mathematics and avoids the concept of state and Variable. WikiWe know that object is the first
The dictionary is the only type of mapping in python, its hash value (key Key) and the point to object (value) is a one-to-many relationship;A dictionary is a mutable object, is a container type, can store any number, any type of mapping type, and
Python built-in functions (24) -- frozenset, pythonfrozenset
English document:
Class
frozenset([
Iterable])
Return a new
frozensetObject, optionally with elements taken from
Iterable.
frozensetIs a built-in class. See
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