Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use Shuffle in python

Shulou Source: shulou.com Published: 2022-06-01 05:15:18 09月29日 Update

This article mainly introduces how to use Shuffle in python. It is very detailed and has a certain reference value. Friends who are interested must finish it!

Shuffle

This algorithm scrambles the order of the list elements, and it mainly sorts the new list through the Fisher-Yates algorithm:

From copy import deepcopy from random import randint def shuffle (lst): temp_lst = deepcopy (lst) m = len (temp_lst) while (m): M-= 1 I = randint (0, m) temp_lst [m], temp_ LST [I] = temp_lst [I], temp_ LST [m] return temp_lst foo = [1je 2jue 3] shuffle (foo) # [2J 3J 1], foo = [1J J 2J 3] what are the main applications of python Typical application OpenStack. 2. WEB front-end development, many large websites are developed by Python. 3. Artificial intelligence applications, which are based on big data's analysis and deep learning, have essentially been unable to leave python. 4. System operation and maintenance project, the standard configuration of automatic operation and maintenance is python+Django/flask. 5. Financial management analysis, quantitative transaction, financial analysis. 6. Big data's analysis.

The above is all the content of the article "how to use Shuffle in python". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Analysis application artificial intelligence content data data analysis intelligence algorithms articles finance development value elements interests typical front end guys buddies that is Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Huawei Shulou Tech Info Shulou Technology NVidia