print "Your answer's sorted: ", ','.join(sorted_list)
Hope that helps,
Ramit
Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423
-Original Message-
From: tutor-bounces+r
"Johnson Tran" wrote
If I put a "answer_list=[]" before the while True: line...is this
correct?
Yes that creates an empty list.
only trying to make a list of the answers, I probably
do not need to save the questions ?
Correct, but
import random
answer_list=[]
while True:
"Johnson Tran" wrote
import random
dice = ...
while True:
...
elif choice == "quit":
True = 0
raw_input()
Do not do this! True is supposed to be a fixed,
constant boolean value. In fact in Python v3 you
will get an error if you try it.
Instead use break to exit from the loop.
: tutor-bounces+bodsda=ubuntu@python.org
Date: Wed, 11 May 2011 03:49:12
To:
Subject: [Tutor] Python program with multiple answers
Hi Guys,
I've been working on a Python program where I create an 8 ball that will allow
you to ask questions and will reply back with 20 possible answer
In addition to the wise counsel you've already received, I noticed that your
randint goes from 0 to 10, but you have 20 possible outcomes in dice(). If
I'm counting correctly, it should be roll=random.randint(0, 19).
Tony R.
On Wed, May 11, 2011 at 6:49 AM, Johnson Tran wrote:
> Hi Guys,
>
> I'
Thanks for all the replies. But, sorry I am getting a little confused. I have
never created a list before and am not really sure where to start. If I put a
"answer_list=[]" before the while True: line...is this correct? Or to go by
Brett's method, how would I go about saving the questions and a
On Wed, May 11, 2011 at 6:49 AM, Johnson Tran wrote:
> I've been working on a Python program where I create an 8 ball that will
> allow you to ask questions and will reply back with 20 possible answers.
...
> if anyone could point me in the right direction it'd be really helpful
Answer cloudy, t
* Create a list.
* Each time, the user gets an answer add it to the list
* At the end of the program: sort the list and print each element of it
- Patrick
On 2011-05-11 12:49, Johnson Tran wrote:
Hi Guys,
I've been working on a Python program where I create an 8 ball that will allow
you to
Hi Guys,
I've been working on a Python program where I create an 8 ball that will allow
you to ask questions and will reply back with 20 possible answers. It will be
continuous until the user says quit. My program works fine although I am trying
to add something more to it, where when the user