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.
Hi,
I would suggest appending the dice[roll] to a new list just after the print
statement, then in the quit block order the list and then loop over it and
print each entry.
Hope this helps,
Bodsda
Sent from my BlackBerry® wireless device
-Original Message-
From: Johnson Tran
Sender: t
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