Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Shuffle in python

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report