A puzzle about + =
Original link: A puzzle about + =
I found a problem in reading today. It's very interesting to share with you.
What are the results of the following two Python expressions?
t = (1, 2, [3, 4])
t[2] += [5, 6]
Give four alternative answers:
t becomes (1, 2, [3, 4, 5, 6]).Because tuple does not support assigning values to its elements, it thr ...
Posted by jimdavidson on Mon, 28 Feb 2022 05:40:58 +0100
Advanced features of python -- slicing and iteration
preface
In Python, the more code is not the better, but the less the better. The code is not as complex as possible, but as simple as possible. Based on this idea, let's introduce the very useful advanced features in Python, the functions that can be realized by one line of code, and never write five lines of code. Keep in mind that the ...
Posted by richtux on Mon, 28 Feb 2022 02:54:53 +0100
MPI parallel programming using Python
Installation of mpi4py
We will use the MPI for Python package mpi4py. If you have a clean geo_scipy environment, as described in Ryan's Python installation instructions on this website, you should be able to install it using conda without any problems. The first thing to do is to open the terminal shell and activate geo_scipy:
source activat ...
Posted by edawg on Sun, 27 Feb 2022 21:45:11 +0100
Python implementation of k-nearest neighbor algorithm
Python implementation of k-nearest neighbor algorithm
1, Overview
K-nearest neighbor algorithm, also known as KNN algorithm, is the simplest algorithm in data mining technology. Working principle of KNN: given a training dataset with known label category, after inputting new data without label, find K instances closest to the new data in the ...
Posted by mrinfin1ty on Sun, 27 Feb 2022 15:31:53 +0100
[secretly kill the little partner Pytorch20 days - day13-nn.functional and nn.Module]
1, NN Functional and NN Module
Earlier, we introduced the structure operation of Pytorch's tensor and some common API s in mathematical operation.
Using these tensor API s, we can construct neural network related components (such as activation function, model layer, loss function).
Most of the functional components related to Pytorch and neu ...
Posted by godsent on Sun, 27 Feb 2022 10:39:22 +0100
[Django backend] wechat applet post requests to return 403 or 500 solutions
Django is simply used to provide the back-end interface for wechat applet. I am responsible for the back-end interface and my classmates are responsible for the front-end. We tested that there is no problem with the get request, but when sending the post request, the return values received by the front-end are always 500 and 403. (PS: if you wa ...
Posted by rel on Sun, 27 Feb 2022 10:08:32 +0100
[Blue Bridge Cup] Langton ant
Langton ant, proposed by Chris Langton in 1986, belongs to a kind of cellular automata. The square grid on the plane is filled with black or white. There is an "ant" in one of the squares. The direction of the ant's head is: up, down, left and right. The movement rules of ants are very simple: If the ant is in a black grid, turn 90 de ...
Posted by briant on Sun, 27 Feb 2022 05:23:03 +0100
[Ji Li 01 group No. 08] SSM framework integration
Python wechat ordering applet course video
https://edu.csdn.net/course/detail/36074
Python actual combat quantitative transaction financial management system
https://edu.csdn.net/course/detail/35475
[Ji Li 01 group No. 08] SSM framework integration
Database preparation
This course uses MySQL database. Start MySQL first:
sudo service mysq ...
Posted by desmi on Sun, 27 Feb 2022 04:50:24 +0100
Write a script in python to dynamically delete the QQ space for many years
Seriously, when I wrote this script, I didn't understand the basic syntax of python. I can only say that language is not important, just easy to use...
As for why I want to delete QQ dynamics, I just don't want to always see those childish words that were sent that year and today. There are many dynamics (although QQ has not been used in recen ...
Posted by jiayanhuang on Sun, 27 Feb 2022 04:28:23 +0100
LRU and LFU algorithms (page replacement algorithm)
Difference between LRU and LFUBoth LRU and LFU are page replacement algorithms for memory management.LRU: Least Recently Used (longest time) elimination algorithm. LRU is the page that has not been used for the longest time.LFU: Least Frequently Used. LFU is the page that has been used the least times in a period of time.exampleSuppose the peri ...
Posted by whatwhat123 on Sun, 27 Feb 2022 03:47:14 +0100