Python data structure and algorithm DAY 1

Data structures and algorithms (Python) 1. Introduction of concepts If a+b+c=1000 and a2+b2=c^2 (a, b and c are natural numbers), how to find all possible combinations of a, b and c? Enumeration method: First attempt import time start_time = time.time() # Note that it is a triple cycle for a in range(0, 1001): for b in range(0, 1001): ...

Added by CreativityLost on Wed, 06 Oct 2021 17:56:33 +0300

Python function decorator

Basic knowledge Everything is an object First, let's understand the functions in Python: def hi(name="yasoob"): return "hi " + name print(hi()) # output: 'hi yasoob' # We can even assign a function to a variable, such as greet = hi # We don't use parentheses here because we're not calling the hi function # Instead, you're putting it ...

Added by Hannes2k on Wed, 06 Oct 2021 17:29:03 +0300

Programmer's happiness - use python to crawl the pictures of beautiful women on the other side of the Internet

When I first entered the world of mortals, I didn't know the suffering of the world, When I look back, I am already a bitter man. One third of the wine in this glass, This wine is sad. Shut it down, shut it down, It's hard every night. May love and hatred in this world melt into wine, Turn this dust into wine A drink to relieve your worries! ...

Added by Matt Phelps on Tue, 05 Oct 2021 22:54:04 +0300

[NLP] news topic classification task

preface Learning objectives Learn about news topic classification and relevant data Master the implementation process of constructing news topic classifier using shallow network About news topic classification tasks: Taking the text description content of a news report as the input, the model is used to help us judge which type of n ...

Added by ragear on Tue, 05 Oct 2021 22:26:59 +0300

Day 28 | learn PyQt5, QTreeWidget of advanced control

The tree structure is implemented through QTreeWidget and qtreewidgettitem classes, in which qtreewidgettitem class implements the addition of nodes. QTreeWidget is a hierarchical nested structure. The outer and inner layers of a tree structure have similar structures. It is often used to represent a data structure with one upper layer and mult ...

Added by fangfang on Mon, 04 Oct 2021 23:22:54 +0300

Python Drawing Library Matplotlib

The Matplotlib library is a package used in Python to draw pictures, which can be used to quickly draw the desired image Catalog 1.Installation Configuration 2.quick get start (1) Canvas (2) Subgraph and Subgraph Layout subplot() subplots() (3) Name of coordinate axis and scale Axis name Coordinate axis range (4) Legends and text lab ...

Added by SquirrelJ on Mon, 04 Oct 2021 20:17:05 +0300

Day 25 | day 28 learn PyQt5, QTableWidget of advanced controls

The table control also has a QTableWidget, which inherits from QTableView. The main difference between QTableWidget and QTableView is that QTableView can use custom data model to display content, while QTableWidget can only use standard data model, and its cell data is realized through qtablewidgettitem object. In general, using QTableWidget ca ...

Added by dbrown on Mon, 04 Oct 2021 05:57:34 +0300

python [machine learning practice] K-proximity algorithm (KNN)

What is K-nearest neighbor algorithm? K-nearest neighbor algorithm (KNN) is one of the classification algorithms. KNN classifies new data by calculating the distance between new data and data points of different categories in historical sample data. Simply put, it is to classify and predict the new data through the k data points closest to the ...

Added by Karve on Mon, 04 Oct 2021 02:20:18 +0300

Principle and implementation of [machine learning] k-nearest neighbor algorithm

Article catalog Catalogue of series articlespreface1, What is the k-nearest neighbor algorithm?2, Use steps 1. Import and storage2. Read in datasummary preface With the continuous development of artificial intelligence, machine learning technology is becoming more and more important. Many people have started learning machine lea ...

Added by schilly on Sun, 03 Oct 2021 22:20:09 +0300

Introduction to python_7 (Learning Notes)

function Definition of function Remember "Everything is an object" in Python? Python treats functions as objects and can return from another function to build higher-order functions, such as: parameters are functions and return values are functions. Let's start with the definition of a function. The function begins with the def ke ...

Added by Anidazen on Sun, 03 Oct 2021 19:54:33 +0300