Вывод ответа #1865410029

-

Python

Обсуждаем данный язык программирования

{autor_name}


{text_rank}
репутация: {repa}
{registration_date}
сообщений: {posts}
{tel_link}
#{postnumber_id}

Ну да, choice возвращает случа йный элемент, а shuffle перемешиваетсяPython 3.2.2 (default, Jun 23 2014, 00:13:13)
[GCC 4.8] on linux-armv7l
Type "help", "copyright", "credits" or "license" for more information.
>>> import random
>>> random.choice([1,2,3])
3
>>> lst = [1,2,3]
>>> random.shuffle(lst)
>>> lst
[3, 2, 1]
>>>


ответ опубликован:
Рейтинг: 5
голосов: 2



Яндекс.Метрика