Using python to write a program for 20 playing cards to play according to certain rules and the minimum number of rounds needed
Title: a deck of playing cards is divided into 13 kinds of cards, each of which has 4 suits, with a total of 52 cards.
It is stipulated that the order from small to large is A23456789TJQK. Now 20 cards are selected from a deck. One of the following rules is selected for each round:
1. Single card - any card.
...
Posted by graham23s on Tue, 31 Dec 2019 05:18:42 -0800
Analysis of c/c++ lambda expression
Analysis of lambda expression
Big premise: capture the timing of variables in the list.
There is a difference between the capture list and the parameter list. The variables in the capture list are determined at the time of capture, not at the time of lambda call. The parameter list is determined at the time of call. So when I capture an int i ...
Posted by markmil2002 on Mon, 30 Dec 2019 12:14:05 -0800
Tips for using python data
1, Filter data from list
For example: get the number of conditions in the collection greater than
lists = [-1,-2,-4,-5,-6,0,1,4,9]
# Find the number greater than 0
str = []
for number in lists:
if number > 0:
str.append(number)
print(str)
#[1, 4, 9]
#Tabular form
str = [x for x in lists if x >0]
print(str)
#P ...
Posted by theironchef on Mon, 30 Dec 2019 10:21:38 -0800
Detailed explanation of bind function of c/c + + standard library
Detailed explanation of bind function of standard library
bind function: receive a function name as a parameter to generate a new function.
auto newCallable = bind(callbale, arg_list);
Arg list may contain parameters such as 1, 2, etc., which are parameters of the new function newCallable.
In this blog Introduction to lambda expression In, ...
Posted by matt2012 on Sun, 29 Dec 2019 07:07:54 -0800
Using Scheme to simulate classes and objects
a. Classes and objects
A function definition can be interpreted as a class, and function calls can play the role of objects. In other words, lambda expressions can be treated as classes, and closures can be treated as objects.
A point class is defined below, and the lambda expression will be returned as an instance object handle of the point cl ...
Posted by colossus_09 on Sun, 29 Dec 2019 05:01:51 -0800
Password encryption of Python hashlib
In the hashlib.md5(data) function, the type of the data parameter should be bytes.
Data must be converted to bytes before hash data must be converted to bytes before hashfrom hashlib import md5
c = md5("helloworld")
# TypeError: Unicode-objects must be encoded before hashing
c = md5("helloworld".encode("utf-8"))
Function de ...
Posted by djopie on Sat, 28 Dec 2019 09:27:06 -0800
Java Efficient Code 50 Cases
Reading Guide
There are only two substances in the world: high efficiency and low efficiency; there are only two kinds of people in the world: high efficiency and low efficiency.--Shaw
Constant-Variable
Assigning constants directly prohibits declaration of new objects
Assigning a constant value directly creates an object reference that points t ...
Posted by Shaba1 on Fri, 27 Dec 2019 20:53:05 -0800
New features of JDK 1.8 - Lambda expression, Stream API, functional interface, method reference
jdk1.8 new feature knowledge points:
Lambda expression
Stream API
Functional interface
Method references and constructor calls
Default and static methods in the interface
New time date API
default
Lambda expression
Lambda is to simplify some of our previous complex codes, such as the judgment and comparison / sorting of colle ...
Posted by Pikachu2000 on Mon, 23 Dec 2019 08:34:34 -0800
Advanced syntax and usage of python (6)
Advanced knowledge is for developers of packages and class libraries. Functions are only executable code, not objects, closures and functional programming
Closure = function + environment variable
a=10
def outer():
a=25
def inner(x):
print(a*x*x)
return inner
f=outer()
# __Close? Built in variable
# enviro ...
Posted by christophebmx on Thu, 19 Dec 2019 14:01:31 -0800
Note 10: introduction to async & await
Task. Field
Task.Yield is simply a task that has been completed at the time of creation, or a task with execution time of 0, or an empty task. In other words, the iscompleted value of the task is set to 0 at the time of creation.
We know that when the Task of await is completed, the thread will be released, and then a new thread will be applied ...
Posted by elgordo1960 on Tue, 17 Dec 2019 22:43:49 -0800