On Fri, Jan 13, 2012 at 6:48 AM, Claude Matherne wrote:
> Hello all,
> I am a beginner to python and I am trying to make a simple program that
> takes in some names as input into a list and then randomly picks a vaule
> from that list as a winner.
>
> Here is the code:
>
> import random
>
> choice
On 13/01/12 10:56, Nick W wrote:
first problem: easy fix just remember that len() returns the actual
number of items in the list but that list is indexed starting at 0 so
just replace your line of
pick = len(names)
with:
pick = len(names) - 1
Another good trick for choosing a
On 01/12/2012 06:56 PM, Nick W wrote:
first problem: easy fix just remember that len() returns the actual
number of items in the list but that list is indexed starting at 0 so
just replace your line of
pick = len(names)
with:
pick = len(names) - 1
and for problem #2:
just use str
On 1/12/2012 5:48 PM, Claude Matherne wrote:
Hello all,
I am a beginner to python and I am trying to make a simple program
that takes in some names as input into a list and then randomly picks
a vaule from that list as a winner.
Here is the code:
import random
choice = None
names = [ ]
while c
first problem: easy fix just remember that len() returns the actual
number of items in the list but that list is indexed starting at 0 so
just replace your line of
pick = len(names)
with:
pick = len(names) - 1
and for problem #2:
just use string formating... like for example instead