Re: [Tutor] Challenge

2009-09-22 Thread Lucas Prado Melo
On Tue, Sep 22, 2009 at 9:13 AM, Ali Sina wrote: > But it prints every number with the string 'heads'. I'm really blank at > this. It may have something to do with the 'random' module. > > You could use the choice function on random. Given a list, the choice function returns a random element of

Re: [Tutor] (no subject)

2009-09-10 Thread Lucas Prado Melo
On Thu, Sep 10, 2009 at 6:44 AM, Dirk Wangsadirdja wrote: > I tested it and it works. But I dont understand why it works. Can someone > please explain it further? Thanks. ~i == -i - 1 http://en.wikipedia.org/wiki/Two%27s_complement ___ Tutor maillist

Re: [Tutor] (no subject)

2009-09-08 Thread Lucas Prado Melo
On Tue, Sep 8, 2009 at 2:09 PM, shellc...@juno.com wrote: > I,m trying to get a phrase from a user and print it backwards using the for > statement along with the range function, but all I get with range function > is integers not alpha. example range(-1) does not work. > > What about range(0, -n,

Re: [Tutor] (no subject)

2009-09-08 Thread Lucas Prado Melo
On Tue, Sep 8, 2009 at 10:48 AM, shellc...@juno.com wrote: > > I want to write a code that allows me to input a phrase and calculate the > number of vowels twice. once with the for loop and second with the while > loop.I can get the for loop to work but, not the while loop. this is my code > and r

Re: [Tutor] A basic question

2009-09-06 Thread Lucas Prado Melo
On Thu, Aug 6, 2009 at 4:20 PM, sharon wrote: > I have been trying how to get a any python program to run by clicking on > the icon. I keep reading on the internet make it executable: > > chmod a+x try_python.py > Did you write: #!/usr/bin/env python at the first line of the file too? > Wher

Re: [Tutor] Pack/Unpack hacking

2009-09-06 Thread Lucas Prado Melo
On Sun, Sep 6, 2009 at 3:20 PM, Tino Dai wrote: > Hi All, > > Hope the people in the US are having a nice Labor Day! I am looking for > the source code > for the pack/unpack functions found in the struct package. As of this > email, I have tried a > strings on the struct.pyc file. The inspect