Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #38589

Re: Pick random choice from variables

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <dwightdhutto@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'example:': 0.03; 'python': 0.09; 'input,': 0.09; 'snippet': 0.09; 'cc:addr:python-list': 0.10; 'commas:': 0.16; 'subject:random': 0.16; 'wrote:': 0.17; 'feb': 0.19; 'import': 0.21; 'cc:2**0': 0.23; 'random': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'select': 0.26; 'message-id:@mail.gmail.com': 0.27; 'selection': 0.29; 'function': 0.30; 'print': 0.32; 'received:google.com': 0.34; 'list': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; '2013': 0.84; 'joel': 0.91; 'eli': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=wn4MpQErme6yhJjr50H2BZB/fqKN//eyvUO8KZx+XL0=; b=VSMbCx+Qs9/5QxlYYh2rMTMPwGuVV7ArLkJbVmbRGStPrblYShGIL8nXJ81uOGKKUP lxWvEIBKHDp0nB3jjj1vt30D2lhEyWjHuM/gotDWGFIdA4An0Sn4v/9/mNyK/rnUEhuR 7mNeWgoBihOE8kwpdOpAd733R5jO1F/QvM9B4UdQ/fYo+u/S/K+1AcShEwQM1hErmbpc /jKhSQl30+bdHiCtl47HPIsvuoJAmV5X9DrofyCKbUH1Scm2MABfGUf0xS2IElUD4xhm U9pI40ob05pxuM442vL26wyj7gHSEfDt4l23SvcFsQMq9dlrnhpFnU7saBbqrnDVyp9t Mmzw==
MIME-Version 1.0
X-Received by 10.224.71.20 with SMTP id f20mr4651482qaj.91.1360519270866; Sun, 10 Feb 2013 10:01:10 -0800 (PST)
In-Reply-To <CAPM-O+zY3wva7WViaj+K-f-WpcpfXTs7vd86_sMHf9hqCoVyTA@mail.gmail.com>
References <2b79c66b-0750-46c5-a436-edf369747af2@googlegroups.com> <CAPM-O+zY3wva7WViaj+K-f-WpcpfXTs7vd86_sMHf9hqCoVyTA@mail.gmail.com>
Date Sun, 10 Feb 2013 13:01:10 -0500
Subject Re: Pick random choice from variables
From David Hutto <dwightdhutto@gmail.com>
To Joel Goldstick <joel.goldstick@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Cc "python-list@python.org" <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1592.1360519279.2939.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1360519279 news.xs4all.nl 6872 [2001:888:2000:d::a6]:43631
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:38589

Show key headers only | View raw


On Sun, Feb 10, 2013 at 12:43 PM, Joel Goldstick
<joel.goldstick@gmail.com> wrote:
>
>
>
> On Sun, Feb 10, 2013 at 12:01 PM, eli m <techgeek201@gmail.com> wrote:
>>
>> How do i make something with python that will ask the user for input, and
>> then use the random.choice function to select a random choice from what the
>> user entered.
Below is a snippet example:

import random as rand

selection_enter = raw_input("Enter Selection List of Three Items
Seperated By Commas: ")

selection_list = selection_enter.split(",")

print selection_list

rand_choice = rand.choice(selection_list)

print rand_choice

-- 
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Pick random choice from variables eli m <techgeek201@gmail.com> - 2013-02-10 09:01 -0800
  Re: Pick random choice from variables Joel Goldstick <joel.goldstick@gmail.com> - 2013-02-10 12:43 -0500
  Re: Pick random choice from variables David Hutto <dwightdhutto@gmail.com> - 2013-02-10 13:01 -0500
  Re: Pick random choice from variables David Hutto <dwightdhutto@gmail.com> - 2013-02-10 13:03 -0500

csiph-web