Re: [Tutor] still clarifying imorting

2013-05-20 Thread eryksun
On Mon, May 20, 2013 at 9:43 PM, Jim Mooney wrote: > If I make a package called jimlib with __init__.py in it, and a > program called bark.py in it, and even put it in site packages, I > still have to import the program with import jimlib.bark > > But I noticed that the pygraphics package is in

Re: [Tutor] still clarifying imorting

2013-05-20 Thread Dave Angel
On 05/20/2013 09:43 PM, Jim Mooney wrote: If I make a package called jimlib with __init__.py in it, and a program called bark.py in it, and even put it in site packages, I still have to import the program with import jimlib.bark But I noticed that the pygraphics package is in site packages, an

Re: [Tutor] Which version of python should i use?

2013-05-20 Thread Amit Saha
Hello Amal, On Mon, May 20, 2013 at 11:24 PM, Amal Thomas wrote: > Thank you very much..!! I am starting to learn python for my Bioinformatics > work, so I would look for the version that has libraries helpful for me.. Do you already have any libraries in mind (or aware of) that you would want

Re: [Tutor] Random Number Game: Returns always the same number - why?

2013-05-20 Thread Amit Saha
Hi Rafael, On Tue, May 21, 2013 at 2:51 AM, Rafael Knuth wrote: > > Your variable assignment for Random_Number is outside of your while > loop. Therefore its value never changes. Put it inside the while loop > just before the print statement and I think you will get what you > > That was it! Tha

[Tutor] still clarifying imorting

2013-05-20 Thread Jim Mooney
If I make a package called jimlib with __init__.py in it, and a program called bark.py in it, and even put it in site packages, I still have to import the program with import jimlib.bark But I noticed that the pygraphics package is in site packages, and has media.py in it, and all I have to do w

Re: [Tutor] reducing lists within list to their set of unique values

2013-05-20 Thread Steven D'Aprano
On 21/05/13 08:49, Treder, Robert wrote: Hi python folks, I have a list of lists that looks something like this: tst = [ [], ['test'], ['t1', 't2'], ['t1', 't1', 't2'] ] I want to change the empty sets to a blank string, i.e., '' and the lists with repeat values to the unique set of values. S

[Tutor] reducing lists within list to their set of unique values

2013-05-20 Thread Treder, Robert
Hi python folks, I have a list of lists that looks something like this: tst = [ [], ['test'], ['t1', 't2'], ['t1', 't1', 't2'] ] I want to change the empty sets to a blank string, i.e., '' and the lists with repeat values to the unique set of values. So I have done the following: >>> for

Re: [Tutor] Tutor Digest, Vol 111, Issue 68

2013-05-20 Thread Jim Mooney
> > import random > > > > Count = 0 > > > > Random_Number = random.randint(1, 100) > > > > while Count <= 100: > > print (Random_Number) > > > > Count = Count + 1 > > There are a few issues here: > * variable names should be lower case > * for this case it's best to use for loop with ran

Re: [Tutor] Random Number Game: Returns always the same number - why?

2013-05-20 Thread Mitya Sirenef
On 05/20/2013 12:55 PM, Thomas Murphy wrote: Mitya, Why is it best in this situation to use range() rather than a while loop? Curious about best practices for the various iterating functions. Thanks! There are a few issues here: * variable names should be lower case * for this case it's best t

Re: [Tutor] Random Number Game: Returns always the same number - why?

2013-05-20 Thread Thomas Murphy
Mitya, Why is it best in this situation to use range() rather than a while loop? Curious about best practices for the various iterating functions. Thanks! > There are a few issues here: > * variable names should be lower case > * for this case it's best to use for loop with range() > * you calcul

Re: [Tutor] Random Number Game: Returns always the same number - why?

2013-05-20 Thread Rafael Knuth
Your variable assignment for Random_Number is outside of your while loop. Therefore its value never changes. Put it inside the while loop just before the print statement and I think you will get what you That was it! Thank you, you made my day, Bob :-) On Mon, May 20, 2013 at 6:37 PM, boB Stepp

Re: [Tutor] Beginner level: Why doesn't my code work?

2013-05-20 Thread Rafael Knuth
But this is all a distraction -- how exactly are you invoking what you think is Python 3.3.0? What is your operating system? My mistake, I am using two laptops with different operating systems (Windows 7 & SUSE 12.3). I am using Python 3.3.0 on the Windows laptop and I was wrongly assuming that I

Re: [Tutor] Random Number Game: Returns always the same number - why?

2013-05-20 Thread Mitya Sirenef
On 05/20/2013 12:31 PM, Rafael Knuth wrote: Hello, > > I wrote a simple program, and I was expecting that I would get 100 different random numbers. Instead, I am getting 100 times exactly the same random number. Can anyone advise how I should alter my program? > > Thank you! > > All the best,

Re: [Tutor] Random Number Game: Returns always the same number - why?

2013-05-20 Thread John R Jones
You need to move this line: Random_Number = random.randint(1, 100) into the loop body, like this: while Count <= 100: Random_Number = random.randint(1, 100) print (Random_Number) Count = Count + 1 Hope this helps. On Mon, May 20, 2013 at 9:31 AM, Rafael Knuth wrote: > Hello

Re: [Tutor] Random Number Game: Returns always the same number - why?

2013-05-20 Thread boB Stepp
On Mon, May 20, 2013 at 11:31 AM, Rafael Knuth wrote: > > Hello, > > I wrote a simple program, and I was expecting that I would get 100 different > random numbers. Instead, I am getting 100 times exactly the same random > number. Can anyone advise how I should alter my program? > > Thank you! >

[Tutor] Random Number Game: Returns always the same number - why?

2013-05-20 Thread Rafael Knuth
Hello, I wrote a simple program, and I was expecting that I would get 100 different random numbers. Instead, I am getting 100 times exactly the same random number. Can anyone advise how I should alter my program? Thank you! All the best, Rafael PS. I am using Python 3.3.0 print (""" This game

Re: [Tutor] Which version of python should i use?

2013-05-20 Thread Steven D'Aprano
On 20/05/13 23:22, Albert-Jan Roskam wrote: To what extent is Ubuntu (I use Mint, but I think that's almost the same) already using Python 3.2 internally? Zero. As far as I know, the only major Linux distro using Python 3 as the standard Python is Arch Linux, and they have a reputation for

Re: [Tutor] Which version of python should i use?

2013-05-20 Thread Albert-Jan Roskam
>On Mon, May 20, 2013 at 5:59 AM, Amal Thomas wrote: >> I am a beginner. I am using a unix sytem (ubuntu 12.10). Python 2.7.3  is >> installed in my system. I found out that Python has version upto 3.3.2. >> Should I update my python version? > >Ubuntu 12.10 should have 3.2.3 installed (the pyth

Re: [Tutor] Which version of python should i use?

2013-05-20 Thread Amal Thomas
Thank you very much..!! I am starting to learn python for my Bioinformatics work, so I would look for the version that has libraries helpful for me.. On Mon, May 20, 2013 at 6:38 PM, Dave Angel wrote: > On 05/20/2013 05:59 AM, Amal Thomas wrote: > >> hi, >> I am a beginner. I am using a uni

Re: [Tutor] Which version of python should i use?

2013-05-20 Thread eryksun
On Mon, May 20, 2013 at 5:59 AM, Amal Thomas wrote: > I am a beginner. I am using a unix sytem (ubuntu 12.10). Python 2.7.3 is > installed in my system. I found out that Python has version upto 3.3.2. > Should I update my python version? Ubuntu 12.10 should have 3.2.3 installed (the python3 pack

Re: [Tutor] Which version of python should i use?

2013-05-20 Thread Dave Angel
On 05/20/2013 05:59 AM, Amal Thomas wrote: hi, I am a beginner. I am using a unix sytem (ubuntu 12.10). Python 2.7.3 is installed in my system. I found out that Python has version upto 3.3.2. Welcome, and thanks for telling us your environment up front. Should I update my python version?

Re: [Tutor] Retrieving data from a web site

2013-05-20 Thread Phil
On 20/05/13 17:55, Peter Otten wrote: I've rerun the script and it still works over here. I'm in Germany, though, and therefore there's a small chance that I'm being served different data. What does import urllib2 Thank you Peter for your detailed reply, I now have a better understanding of

[Tutor] Which version of python should i use?

2013-05-20 Thread Amal Thomas
hi, I am a beginner. I am using a unix sytem (ubuntu 12.10). Python 2.7.3 is installed in my system. I found out that Python has version upto 3.3.2. Should I update my python version? Is the syntaxes of the each version different? Thanks, Thomas ___

Re: [Tutor] os.getcwd() confusion

2013-05-20 Thread Peter Otten
spangled spanner wrote: > G'day, > > I have a comprehension issue here! I have made two simple scripts: > > ## script1 > > import os > > print os.getcwd() > > - > ## script 2 > > import os > > f = open('test', 'wb') > f.write(os.getcwd()) > f.close() > > ___