Python basics review

Article catalog Article catalog Content introduction 1, What is the list? 2, List operation (1) Index of the list (2) Addition and deletion of list elements (3) Sort the list and find the length of the list summary Content introduction This section mainly talks about lists in Python basics, and explains the establishment of lis ...

Posted by meckr on Thu, 13 Jan 2022 14:39:15 +0100

Sorting API problem

Sorting API 1. Static sorting API in arrays class **Arrays. Sort (data type [] a) uses quick sort, and the time complexity is O(nlogn) Sorts the specified array of types in ascending numerical order. instable Arrays.sort(T[],Comparator<? super T> c) ,Arrays.sort(Object[] a) The specified object array is sorted according to ...

Posted by markthien on Mon, 10 Jan 2022 18:02:29 +0100

Java Collection interface: List interface & Set interface

Big data technology AI Flink/Spark/Hadoop / data warehouse, data analysis, interview, source code interpretation and other dry goods learning materials 101 original content official account 1. List interface The elements in the List collection class are ordered and repeatable, and each element in the collection has its corresponding seq ...

Posted by fredroines on Mon, 10 Jan 2022 03:40:09 +0100

List, tuple, string, set, dictionary summary of python

List, tuple, string, set, dictionary summary This week, I learned five container types: list, tuple, string, set and dictionary. The following is a simple summary of the five container types to make people better understand them. Representation in python List ------------ > [element, element, element] Tuple ------------ > (element, ele ...

Posted by Amit Rathi on Wed, 05 Jan 2022 10:17:22 +0100

Write good Python comments

Python comments Block and inline comments # Block comments are generally used to describe the code below if a > 10 : # according to PEP8 Specification, block annotation with a#And a space, unless indenting is required in block comments a = 10 else: # A block comment should have the same indentation as the code it is commenting ...

Posted by someone2088 on Tue, 04 Jan 2022 01:21:09 +0100

Python basic exercises, including answer analysis

Hello, I'm spicy.   Today, I'll sort out some Python exercises [including answer analysis]. You can try it yourself first, and then check with the answer analysis at the end of the text. I hope it can help you. Exercises 1. Use the formatted output of the string to complete the display of the following business cards ==========My busin ...

Posted by mizz key_me on Mon, 03 Jan 2022 22:41:16 +0100

Java 8 uses Stream stream to operate List

Java 8 uses Stream stream to operate List create object //user object public class UserPO { @ApiModelProperty(example = "", required = false, value = "Serial number") private Integer id; @ApiModelProperty(example = "", required = false, value = "full name") private String name; @ApiModelProperty(example = "", required ...

Posted by superwormy on Thu, 30 Dec 2021 18:21:19 +0100

Tell you some basic Python methods you don't know about

When in if perhaps while Statement, or as the operand of the following Boolean operation, an object will be checked to determine whether a value is true By default, an object, if its class defines an object that returns False __bool__() Function, or a function that returns 0 __len__() Function, then it will be judged as false. In other cases, ...

Posted by Henks on Tue, 28 Dec 2021 00:57:28 +0100

Tanabata Festival is coming soon. Those with objects and those without objects must be magical. Make a fireworks show in Python

Today is Wednesday, and there are three days left for Tanabata Festival. I'm afraid it's too late to buy gifts for my girlfriend! Then what shall I do? Then prepare a fireworks video for her. But not everyone can set off fireworks in the whole city except local tyrants. I can only think about an ordinary one. Although the dream is far away, I ...

Posted by bigbob on Sun, 26 Dec 2021 08:01:29 +0100

Who suspended my Python multiprocess

Recently, I encountered a process suspension problem when using Python's multiprocessing module. Let's record it here. First, the minimum code of a multi process application is given. import multiprocessing as mp def produce(q): """producer""" for i in [1, 2, 3, 4, 5, 6, 7, 8, 9]: q.put(i) print(f"Producer quit.") def c ...

Posted by anon_login_001 on Thu, 23 Dec 2021 21:32:10 +0100