ObjectiveWhen little buddy A is adding fish balls to the pot, this is the producer's behavior; another small partner B eats fish balls is consumer behavior. When the pot inside the fish to reach a certain number of fill after the B to eat, this is a
Notes
What is BIF?Answer: BIF is built-in Functions, built-in function. To facilitate quick scripting, Python provides a very rich built-in function that we only need to call directly, such as the function of print () is "printing to the screen",
A holistic initial knowledge data type1.1intThe number is mainly used for computing, not many ways to use, just remember one can:# bit_length () when decimal is represented by a binary, the minimum number of bits i = 4print= oneprint3, 4
1. Use Python to solve math problems.ABCD Multiply 9 = DBCA so a=?,b=?,c? D=?For-A in range (1,10): for-B in range (0,10): for- C in range (0,10): for-D in range (1,10): if (a*1000 + B * 1 XX + C * +d) * 9 = = (d*1000
One: Formatted outputExisting practice needs, ask the user's name, age, work, hobbies, and then print into the following format------------info of Alex Li------Name : Alex LiAge : 22Job : TeacherHobbie:girl-------------End-----------------The
The Psutil is a cross-platform library that makes it easy to get the process and system utilization information for the system running. It is mainly used for system monitoring, analyzing and restricting system resources and process management. It
1. Tuple OperationBefore we define a variable, it is best to declare the type of the variable, asl=list() # l为列表print(l)t=tuple() # t为元组print(t)When we define the same element, different ways of writing will get
The main function of a calculator is subtraction, so how can Python be implemented?#!/usr/bin/env python#-*-coding:utf-8-*-# @Time: 2018/1/22 22:29# @Author: zhouyuyao# @File: daemoncalculator.py# py Charm 2017.3.2 (Community Edition) # Build #PC -17
1, Reflection Reflection: Use the name of the string type to manipulate the variable reflection there is no security problem, to manipulate the existing variables in memory #反射对象中的属性和方法class A: price =20print(GetAttr (A,'price'))#反射对象的属性class A:
One, formatted output: PlaceholderWrite the code, output the following: You will find that the way to use the character stitching is difficult to achieve the output of this format, you need to print the format first readyBecause some of the
Detailed, more in-depth, such as the collection capacity initialization, expansion, and now just learn the basic usage.------------------List--------------------#Li = [A.'456', [[+]], {1:' One', 2:' Both'}]Print(Type (list))Print(Type
One, operator1. Arithmetic operator +-*/% * *//2**10 2 of the 10-time Square4.2//2 = = 2 Take the integer part, the integer part of the fetch quotientPy2 4.2/2 ==2Py3 4.2/2 = = 2.1Second, assignment operation= Simple Assignment+ = Addition
1. Compile-type:Compile the source code all at once into binary. CAdvantages: High execution efficiency.Disadvantage: Development efficiency is slow, can not be used across platforms.Explanatory type:When the program executes, the code is
The function properties of a class are bound to different objects and are different binding methods. When an object invokes a binding method, it passes the object itself as a self parameterSample codeclassPeople:country=' China'? def __init__(self,
Method
Method
Describe
Re.compile (Pattern[,flag])
Compile regular expressions to generate pattern instances
Re.match (Pattern, string, flags=0)
Try to match a pattern from the beginning
DescribeThe Python Strip () method removes the character specified by the string's Kinsoku (the default is a space).GrammarStrip () method syntax:Str.strip ([chars]);ParametersChars--Removes the character specified by the tail of the string.return
Because of the polymorphic examples previously written, there seems to be a bit of a problem, now rewrite the makeover.The "" "polymorphic feature is that invoking different subclasses will produce different behaviors without having to know exactly
Teach you how to use python to get a ticket to go home for the New Year (simple code), python to go home for the New Year
First, let's take a look at how to quickly view the remaining train tickets?
When you want to query the train ticket
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