Average value of lookup list

I must be Python The average value of the list found in. So far, this is my code l = [15, 18, 2, 36, 12, 78, 5, 6, 9] print reduce(lambda x, y: x + y, l) I already know, so it can add the values in the list, but I don't know how to divide it into them? #1 building l = [15, 18, 2, 36, 12, 78, ...

Posted by ksb24930 on Fri, 31 Jan 2020 06:34:55 +0100

Using Python to solve two written test questions from Alibaba music system

Catalog Catalog Preface Topic 1 Analysis Realization Topic two Analysis Realization Preface When a friend comes to Ali for an interview and shares two small questions, the blogger will try to solve them in Python when he is free. There must be many ways to realize them, and the advantages and disadvantages wi ...

Posted by SystemOverload on Wed, 29 Jan 2020 17:08:27 +0100

How do I find a way to call the current method?

How do I know the name of the method that calls the current method when I log in to C??I know all about System.Reflection.MethodBase.GetCurrentMethod(), but I want to be one level lower in stack tracking.I've considered resolving stack traces, but I want to find a clearer, clearer way, similar to As ...

Posted by suspect on Fri, 24 Jan 2020 07:10:47 +0100

IO Stream, Four Interfaces, and Simplified Lambda Important Points

IO Stream IO: Transfer data, do input and output, copy, upload and download... Flow: A series of flowing data, flowing in a first-in, first-out fashion, in a pipe By flow direction: all brain centered, program centered For example: File (Data Source) - Input Stream - > Program (Destination) Progra ...

Posted by jeff21 on Sun, 19 Jan 2020 02:25:47 +0100

Two ways to get Stream stream

Two ways to get Stream stream Two ways to get Stream stream Demo01GetStream package cn.xiaoge.day21.demo02; /* java.util.stream.Stream<T>Java 1.8 is the most commonly used new stream interface Getting a flow is very simple. There are several common ways: All Collection colle ...

Posted by abolmeer on Sat, 18 Jan 2020 16:59:39 +0100

Concurrent learning in Java: multiple ways to create threads

Multiple ways to create threads Inherit Thread class Implement the Runnable interface How anonymous inner classes work Method with return value timer Implementation of thread pool Implementation of Lambda expression 1, Inherit Thread class public class Demo1 extends Thread{ public Demo1(String name) { super(name); ...

Posted by hush on Fri, 10 Jan 2020 19:15:30 +0100

19 programming that must be mastered in Java se Foundation

1. Reverse order of array public void getReverse1(int[]arr) { int start=0; int end=arr.length-1; for(int i=0;i<arr.length/2;i++) { int temp=arr[start]; arr[start]=arr[end]; arr[end]=temp; start++; end--; } } public void getReverse2(int []a ...

Posted by morris520 on Sat, 04 Jan 2020 18:10:30 +0100

Causes the simulation method to return the parameters passed to it

Consider signing as follows: public String myFunction(String abc); Can Mockito help return the same string that the method received? #1 building If you have Mockito 1.9.5 or later, there is a new static method to create an Answer object for you. You need to write something like import static org.mockito.Mockito.when; import static ...

Posted by SkillsToShow on Fri, 03 Jan 2020 12:35:33 +0100

Four confusing references in Python

First: differences in execution timing 1. 1 array = [1, 8, 15] 2 g = (x for x in array if array.count(x) > 0) 3 array = [2, 8, 22]   Output: 1 >>> print(list(g)) 2 [8]   2. 1 array_1 = [1,2,3,4] 2 g1 = (x for x in array_1) 3 array_1 = [1,2,3,4,5] 4 5 array_2 = [1,2,3,4] 6 g2 = (x for x in array_2) 7 array_2[:] = [1,2,3,4,5]   ...

Posted by saraadmin on Thu, 26 Dec 2019 08:47:07 +0100

Introduction to python tool library bidict: Bidirectional Dictionary

quick get start >>> husbands2wives = bidict({'john': 'jackie'}) >>> husbands2wives['john'] # the forward mapping is just like with dict 'jackie' >>> husbands2wives[:'jackie'] # use slice for the inverse mapping 'john' "Prefix the slice with a colon to indicate an inverse mapping. Similar to data sli ...

Posted by Vbabiy on Tue, 24 Dec 2019 16:33:55 +0100