Robert Sjoblom wrote:
> #assuming target number 15
> roll = (result, initial_mins, initial_max)
> if roll[0] > 15:
> if roll[1] >= 2:
> print("Success")
> elif roll[2] >= 2:
> print("Critical failure!")
> else:
> print("Failure.")
> elif roll[0] <= 15:
> if
Well, I'm not sure what your asking for the first question, but for the
second one, you would have an unhandled exception in your code if roll[0]
was less than or equal to 0. Hope that helps a bit!
On Fri, Aug 26, 2011 at 8:55 AM, TheIrda wrote:
> Hello,
>
> I'm quite new on python, so don't hi
On 08/26/2011 11:49 AM, Prasad, Ramit wrote:
Yep, it is. Thanks those charts are exactly what I wanted! Now I have another
question. What is the difference between what print shows and what the
interpreter shows?
print s.decode('latin-1')
MÉXICO
The decoded characters are a Unicode string.
Prasad, Ramit wrote:
Think about it this way... if I gave you a block of data as hex
bytes:
240F91BC03...FF90120078CD45
and then asked you whether that was a bitmap image or a sound file
or something else, how could you tell? It's just *bytes*, it could
be anything.
Yes, but if you give me da
>In this case, the encoding is almost certainly "latin-1". I know that
>from playing around at the interactive interpreter, like this:
>
> >>> s = 'M\xc9XICO'
> >>> print s.decode('latin-1')
> MÉXICO
>
>If you want to see charts of various encodings, wikipedia has a bunch.
> For instance, the Lati
On Thu, Aug 25, 2011 at 7:07 PM, Prasad, Ramit
wrote:
> Nice catch! Yeah, I am stuck on the encoding mechanism as well. I know how to
> encode/decode...but not what encoding to use. Is there a reference that I can
> look up to find what encoding that would correspond to? I know what the
> chara
>if roll[0] > 15:
> .
>elif roll[0] <=15: <--- this is redundant. already checked for > 15 so if
>here is always <= 15
> if roll[1] >= 2:
>
>you can change with:
>
>elif roll[1] >= 2:
That is not true. The first one looks at index [0], while the second one is
index[1].
>>if roll[
>Think about it this way... if I gave you a block of data as hex bytes:
>
>240F91BC03...FF90120078CD45
>
>and then asked you whether that was a bitmap image or a sound file or
>something else, how could you tell? It's just *bytes*, it could be anything.
Yes, but if you give me data and then tell
Hello,
I'm quite new on python, so don't hit too hard if I'm wrong ;)
A question on the logic... Does this means
if roll[0] > 15:
if roll[1] >= 2:
print("Success")
elif roll[2] >= 2:
print("Critical failure!")
that rolling multiple 1's get the priority on rolling multiple