Re: [Tutor] help regarding game code

2013-05-12 Thread Matthew Ngaha
 bWater.clicked.connect( water_clicked ) AttributeError: 'int

use a paste site like http://bpaste.net/+python to show us the code.

i am no expert @ programming myself but that error is telling you you
used an int and tried to access an int method called connect somewhere
in your code. ints do not have this method. However some PyQt objects
(mostly button widgets) do have this method, which is actually a
signal called clicked for when you mouse click on the widget(button).
So basically ints (integers) do not have signals, try and connect the
name(variable name) of what you are clicking to that method, instead
of the int object (bWater)

bWater.clicked.connect( water_clicked )  should become:

button_name.clicked.connect( water_clicked )
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help regarding game code

2013-05-12 Thread Mark Lawrence

On 12/05/2013 22:44, Matthew Ngaha wrote:

bWater.clicked.connect( water_clicked ) AttributeError: 'int


use a paste site like http://bpaste.net/+python to show us the code.



No, please put the code inline.  If the original is too long cut it down 
as requested here http://www.sscce.org/


--
If you're using GoogleCrap™ please read this 
http://wiki.python.org/moin/GoogleGroupsPython.


Mark Lawrence

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help regarding game code

2013-05-12 Thread Dave Angel

On 05/12/2013 03:40 PM, Alex Norton wrote:

im new to python and im in the middle of making a RPS game for a college
unit.


You sent this message 20 minutes after posting a similar one, with a 
DIFFERENT title, on python-list.  You really ought to pick a target and 
pull the trigger once.  Only if no useful responses happen within a day 
or two should you bother the same people a second time on the other forum.


This is not a beginner question, so it belonged on python-list as you 
did first.



--
DaveA
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help on python

2013-04-15 Thread Mark Lawrence

On 15/04/2013 09:54, Jabesa Daba wrote:

is it possible to reorder a sentence in the form of SVO (Subject Verb
Object) into the form of SOV (Subject Object Verb) by using a python
program? if so, how?

regards,



Yes.  By writing code.

You could have answered your own question by typing something like 
python natural language processing into your favourite search engine.


--
If you're using GoogleCrap™ please read this 
http://wiki.python.org/moin/GoogleGroupsPython.


Mark Lawrence

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help on python

2013-04-15 Thread Alan Gauld

On 15/04/13 09:54, Jabesa Daba wrote:

is it possible to reorder a sentence in the form of SVO (Subject Verb
Object) into the form of SOV (Subject Object Verb) by using a python
program? if so, how?


Python is a general purpose programming language so yes, you can program 
it to do any computational task. How much work is involved depends on 
how well you can define the algorithm and whether somebody else has 
already implemented it for you in Python.


In your case you need to consider which language you are processing and 
what the grammatical rules are (what is a word? How do you identify a 
subject, object and verb? What are the separator rules and do you need 
to consider changes of endings etc when you change order? etc)

Just how sophisticated does it need to be?)

There are several libraries that can help ranging from general
purpose text processing and parsers to natural language tookits.
Whatever you use you will still need a fair amount of effort
to get it working. Google (or any other search engine!) is your
friend.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help on python

2013-04-15 Thread Danny Yoo
For example, see: http://nltk.org.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help required

2013-04-04 Thread Mitya Sirenef

On 03/20/2013 02:12 AM, Arijit Ukil wrote:
I am new to python. My intention is to read the file digi.txt and 
store in separate arrays all the values of each columns. However, the 
following program prints only the last value, i.e. 1350696500.0.

Please help to rectify this.

f = open (/digi.txt/, /r+/)

datafile = f.readlines()

list_of_lists = datafile
fordata inlist_of_lists:
lstval = data.split (/','/)
timest = float(lstval[0])
energy = float(lstval[1])

f.close()
printtimest

Regards,
Arijit Ukil



You would want to create an empty list and then
append values to it inside the loop. E.g. lst=[]; lst.append(val)

 -m

--
Lark's Tongue Guide to Python: http://lightbird.net/larks/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help required

2013-04-04 Thread Bod Soutar
On 20 March 2013 06:12, Arijit Ukil arijit.u...@tcs.com wrote:
 I am new to python. My intention is to read the file digi.txt and store in
 separate arrays all the values of each columns. However, the following
 program prints only the last value, i.e. 1350696500.0.
 Please help to rectify this.

 f = open (digi.txt, r+)

 datafile = f.readlines()

 list_of_lists = datafile
 for data in list_of_lists:
 lstval = data.split (',')
 timest = float(lstval[0])
 energy = float(lstval[1])

 f.close()
 print timest

A few questions to ask yourself.

Is 'f' a descriptive name, equivalent to your other variable names?
What does your third line do, and do you think it's actually required?
What implications would it cause if you removed it?
How do you overcome those issues?
What value is stored in 'timest' the first iteration of the loop, the
second, the third? (Put a print statement in the loop to find out)
Are you actually doing anything with 'energy'?
Do you need to wait until after the loop to close your file?

HTH,
Bodsda
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help required

2013-04-04 Thread Mark Lawrence

First up please give a sensible subject, say problem parsing csv file.

I'm assuming the crud shown below is due to you posting in html, please 
use plain text instead.


On 20/03/2013 06:12, Arijit Ukil wrote:

I am new to python. My intention is to read the file digi.txt and store
in separate arrays all the values of each columns. However, the
following program prints only the last value, i.e. 1350696500.0.
Please help to rectify this.

f = open (/digi.txt/, /r+/)


You might like to use the with statement as it saves the explicit close 
later.  Do you really need update mode?  I'll assume not.


with open('digi.txt', 'r') as f:



datafile = f.readlines()


datafile is a poor name, it's the contents of the file here not the file 
itself.




list_of_lists = datafile


This gives another name for datafile which you only use in the for loop, 
you can use datafile directly.



fordata inlist_of_lists:
 lstval = data.split (/','/)


The csv module from the standard library can look after this for you.


 timest = float(lstval[0])
 energy = float(lstval[1])


You do nothing with timest and energy within the for loop.



f.close()
printtimest


You're printing the last value for timest here.

So you need something like the following, I'll leave you to look up the 
csv module if you're interested.


with open('digi.txt', 'r') as f:
lines = f.readlines()
timestamps = []
energies = []
for line in lines:
splits = line.split(',') # I'll admit not the best name
timestamps.append(float(splits[0]))
energies.append(float(splits[1]))

# process timestamps and energies to your heart's content



Regards,
Arijit Ukil


--
If you're using GoogleCrap™ please read this 
http://wiki.python.org/moin/GoogleGroupsPython.


Mark Lawrence

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with iterators

2013-03-28 Thread Matthew Johnson
Dear list,

Sorry for the delay -- it has taken some time for me to get these emails.

It appears i made some dumb error when typing out the description.

Mitya Sirenef was correct to ignore my words and to focus on my code.

Thanks for your help. I may ask again / for more help when i feel i
have tried sufficiently hard to absorb the answers below.

Thanks again

mj

On 22/03/2013, at 6:24 PM, tutor-requ...@python.org
tutor-requ...@python.org wrote:

 Send Tutor mailing list submissions to
tutor@python.org

 To subscribe or unsubscribe via the World Wide Web, visit
http://mail.python.org/mailman/listinfo/tutor
 or, via email, send a message with subject or body 'help' to
tutor-requ...@python.org

 You can reach the person managing the list at
tutor-ow...@python.org

 When replying, please edit your Subject line so it is more specific
 than Re: Contents of Tutor digest...


 Today's Topics:

   1. Re: Help with iterators (Mitya Sirenef)
   2. Re: Help with iterators (Steven D'Aprano)
   3. Re: Help with iterators (Steven D'Aprano)
   4. Re: Help with iterators (Mitya Sirenef)
   5. Please Help (Arijit Ukil)


 --

 Message: 1
 Date: Thu, 21 Mar 2013 21:39:12 -0400
 From: Mitya Sirenef msire...@lightbird.net
 To: tutor@python.org
 Subject: Re: [Tutor] Help with iterators
 Message-ID: 514bb640.5050...@lightbird.net
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed

 On 03/21/2013 08:39 PM, Matthew Johnson wrote:
 Dear list,

 I have been trying to understand out how to use iterators and in
 particular groupby statements. I am, however, quite lost.

 I wish to subset the below list, selecting the observations that have
 an ID ('realtime_start') value that is greater than some date (i've
 used the variable name maxDate), and in the case that there is more
 than one such record, returning only the one that has the largest ID
 ('realtime_start').

 The code below does the job, however i have the impression that it
 might be done in a more python way using iterators and groupby
 statements.

 could someone please help me understand how to go from this code to
 the pythonic idiom?

 thanks in advance,

 Matt Johnson

 _

 ## Code example

 import pprint

 obs = [{'date': '2012-09-01',
 'realtime_end': '2013-02-18',
 'realtime_start': '2012-10-15',
 'value': '231.951'},
 {'date': '2012-09-01',
 'realtime_end': '2013-02-18',
 'realtime_start': '2012-11-15',
 'value': '231.881'},
 {'date': '2012-10-01',
 'realtime_end': '2013-02-18',
 'realtime_start': '2012-11-15',
 'value': '231.751'},
 {'date': '2012-10-01',
 'realtime_end': '-12-31',
 'realtime_start': '2012-12-19',
 'value': '231.623'},
 {'date': '2013-02-01',
 'realtime_end': '-12-31',
 'realtime_start': '2013-03-21',
 'value': '231.157'},
 {'date': '2012-11-01',
 'realtime_end': '2013-02-18',
 'realtime_start': '2012-12-14',
 'value': '231.025'},
 {'date': '2012-11-01',
 'realtime_end': '-12-31',
 'realtime_start': '2013-01-19',
 'value': '231.071'},
 {'date': '2012-12-01',
 'realtime_end': '2013-02-18',
 'realtime_start': '2013-01-16',
 'value': '230.979'},
 {'date': '2012-12-01',
 'realtime_end': '-12-31',
 'realtime_start': '2013-02-19',
 'value': '231.137'},
 {'date': '2012-12-01',
 'realtime_end': '-12-31',
 'realtime_start': '2013-03-19',
 'value': '231.197'},
 {'date': '2013-01-01',
 'realtime_end': '-12-31',
 'realtime_start': '2013-02-21',
 'value': '231.198'},
 {'date': '2013-01-01',
 'realtime_end': '-12-31',
 'realtime_start': '2013-03-21',
 'value': '231.222'}]

 maxDate = 2013-03-21

 dobs = dict([(d, []) for d in set([e['date'] for e in obs])])

 for o in obs:
 dobs[o['date']].append(o)

 dobs_subMax = dict([(k, [d for d in v if d['realtime_start'] = maxDate])
 for k, v in dobs.items()])

 rts = lambda x: x['realtime_start']

 mmax = [sorted(e, key=rts)[-1] for e in dobs_subMax.values() if e]

 mmax.sort(key = lambda x: x['date'])

 pprint.pprint(mmax)
 ___
 Tutor maillist - Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor


 You can do it with groupby like so:


 from itertools import groupby
 from operator import itemgetter


 maxDate = 2013-03-21
 mmax= list()

 obs.sort(key=itemgetter('date'))

 for k, group in groupby(obs, key=itemgetter('date')):
 group = [dob for dob in group if dob['realtime_start'] = maxDate]
 if group:
 group.sort(key=itemgetter('realtime_start'))
 mmax.append(group[-1])

 pprint.pprint(mmax)


 Note that writing multiply-nested comprehensions like you did results in
 very unreadable code. Do you find this code more readable?

  -m


 --
 Lark's Tongue Guide to Python: http://lightbird.net/larks/

 Many a man fails as an original thinker simply because his memory it too
 good.  Friedrich Nietzsche



 --

 Message: 2

Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Amit Saha
Hi Sayan,

On Wed, Mar 27, 2013 at 4:14 PM, Sayan Chatterjee
sayanchatter...@gmail.com wrote:
 Dear All,

 I am a newbie to Python but have a fair know how of other languages i.e C
 etc.

 I want to run an astrophysical simulation in Python. All I have to do it to
 generate a set of 'plots' depending on a varying parameter and then stitch
 them up.

 1) Is it possible to automatically generate different data files( say in the
 orders of 1000) with different names depending on a parameter?

It certainly is. Are you talking about the file names being
file_1001.txt, file_1002.txt and so on? If yes, let's say  your
parameter values are stored in param. Then something like this would
do the trick:

param_values = [1000,1001, 1005, 2001]

for param in param_values:
fname = 'file_' + str(param)


   # write to file fname
   #
   #


Sorry if its different from what you are looking for. But yes, its
certainly possible.



 2) Is it possible to plot the data sets right from Python itself and save
 the plots in different jpeg files to stitched upon later on.

It is possible to generate plots and save each as JPEGs. [1].

What do you mean by stitching together?

[1] http://stackoverflow.com/questions/8827016/matplotlib-savefig-in-jpeg-format


Best,
Amit
-- 
http://amitsaha.github.com/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Amit Saha
On Wed, Mar 27, 2013 at 4:23 PM, Amit Saha amitsaha...@gmail.com wrote:
 Hi Sayan,

 On Wed, Mar 27, 2013 at 4:14 PM, Sayan Chatterjee
 sayanchatter...@gmail.com wrote:
 Dear All,

 I am a newbie to Python but have a fair know how of other languages i.e C
 etc.

 I want to run an astrophysical simulation in Python. All I have to do it to
 generate a set of 'plots' depending on a varying parameter and then stitch
 them up.

 1) Is it possible to automatically generate different data files( say in the
 orders of 1000) with different names depending on a parameter?

 It certainly is. Are you talking about the file names being
 file_1001.txt, file_1002.txt and so on? If yes, let's say  your
 parameter values are stored in param. Then something like this would
 do the trick:

 param_values = [1000,1001, 1005, 2001]

 for param in param_values:
 fname = 'file_' + str(param)


# write to file fname
#
#


 Sorry if its different from what you are looking for. But yes, its
 certainly possible.



 2) Is it possible to plot the data sets right from Python itself and save
 the plots in different jpeg files to stitched upon later on.

 It is possible to generate plots and save each as JPEGs. [1].

 What do you mean by stitching together?

You probably meant creating an animation from them. Yes,  it is
certainly possible. I will try to find a link which makes it really
easy to create an animation out of a bunch of images. Which operating
system are you on?

-Amit.



-- 
http://amitsaha.github.com/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Sayan Chatterjee
Thanks a lot for your prompt reply.

1. Yes. This is exactly what I wanted. Creating a bunch of data sets and
then writing script to plot them using gnuplot, but if something can
produce directly 'plots' it will certainly be helpful.

2. Yes. By stitching them up I meant an animation.Sorry for the
ambiguity. Exactly how we can do it Octave.

Pls see this link:
http://www.krizka.net/2009/11/06/creating-animations-with-octave/

I think Python is THE language, which may come to an immediate rescue.

My OS is Linux Mint (Gnome 3)

Sayan


On 27 March 2013 11:57, Amit Saha amitsaha...@gmail.com wrote:

 On Wed, Mar 27, 2013 at 4:23 PM, Amit Saha amitsaha...@gmail.com wrote:
  Hi Sayan,
 
  On Wed, Mar 27, 2013 at 4:14 PM, Sayan Chatterjee
  sayanchatter...@gmail.com wrote:
  Dear All,
 
  I am a newbie to Python but have a fair know how of other languages i.e
 C
  etc.
 
  I want to run an astrophysical simulation in Python. All I have to do
 it to
  generate a set of 'plots' depending on a varying parameter and then
 stitch
  them up.
 
  1) Is it possible to automatically generate different data files( say
 in the
  orders of 1000) with different names depending on a parameter?
 
  It certainly is. Are you talking about the file names being
  file_1001.txt, file_1002.txt and so on? If yes, let's say  your
  parameter values are stored in param. Then something like this would
  do the trick:
 
  param_values = [1000,1001, 1005, 2001]
 
  for param in param_values:
  fname = 'file_' + str(param)
 
 
 # write to file fname
 #
 #
 
 
  Sorry if its different from what you are looking for. But yes, its
  certainly possible.
 
 
 
  2) Is it possible to plot the data sets right from Python itself and
 save
  the plots in different jpeg files to stitched upon later on.
 
  It is possible to generate plots and save each as JPEGs. [1].
 
  What do you mean by stitching together?

 You probably meant creating an animation from them. Yes,  it is
 certainly possible. I will try to find a link which makes it really
 easy to create an animation out of a bunch of images. Which operating
 system are you on?

 -Amit.



 --
 http://amitsaha.github.com/




-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Amit Saha
On Wed, Mar 27, 2013 at 4:36 PM, Sayan Chatterjee
sayanchatter...@gmail.com wrote:
 Thanks a lot for your prompt reply.

 1. Yes. This is exactly what I wanted. Creating a bunch of data sets and
 then writing script to plot them using gnuplot, but if something can produce
 directly 'plots' it will certainly be helpful.

Yes, indeed it is possible. You may want to explore matplotlib a bit.
You can start with this tutorial [1].

[1] http://www.loria.fr/~rougier/teaching/matplotlib/


 2. Yes. By stitching them up I meant an animation.Sorry for the ambiguity.
 Exactly how we can do it Octave.

 Pls see this link:
 http://www.krizka.net/2009/11/06/creating-animations-with-octave/

Right, yes, if you see it uses mencoder/ffmpeg to create the
animation. So, if you save your individual plots and then use one of
these tools, you should be able to get the animation done.

Matplotlib itself seems to have some Animated plotting capabilities,
but I haven't had any experience with them.


Best,
Amit.


-- 
http://amitsaha.github.com/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Sayan Chatterjee
Yes, ffmpeg will do if multiple plots can be generated using mathplotlib .
I'll look up the links you provided and get back to you, if I can't figure
it out. :)




On 27 March 2013 12:12, Amit Saha amitsaha...@gmail.com wrote:

 On Wed, Mar 27, 2013 at 4:36 PM, Sayan Chatterjee
 sayanchatter...@gmail.com wrote:
  Thanks a lot for your prompt reply.
 
  1. Yes. This is exactly what I wanted. Creating a bunch of data sets and
  then writing script to plot them using gnuplot, but if something can
 produce
  directly 'plots' it will certainly be helpful.

 Yes, indeed it is possible. You may want to explore matplotlib a bit.
 You can start with this tutorial [1].

 [1] http://www.loria.fr/~rougier/teaching/matplotlib/

 
  2. Yes. By stitching them up I meant an animation.Sorry for the
 ambiguity.
  Exactly how we can do it Octave.
 
  Pls see this link:
  http://www.krizka.net/2009/11/06/creating-animations-with-octave/

 Right, yes, if you see it uses mencoder/ffmpeg to create the
 animation. So, if you save your individual plots and then use one of
 these tools, you should be able to get the animation done.

 Matplotlib itself seems to have some Animated plotting capabilities,
 but I haven't had any experience with them.


 Best,
 Amit.


 --
 http://amitsaha.github.com/




-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Sayan Chatterjee
Hi Amit,

fo = fopen('fname','r+')
fo.write(%d   %d,j,counter)


Is giving the following error:

File ZA.py, line 30, in module
fo = open('fname','r+')
IOError: [Errno 2] No such file or directory: 'fname'

Where is the mistake?

Cheers,
Sayan






On 27 March 2013 12:20, Amit Saha amitsaha...@gmail.com wrote:

 On Wed, Mar 27, 2013 at 4:49 PM, Sayan Chatterjee
 sayanchatter...@gmail.com wrote:
  Yes, ffmpeg will do if multiple plots can be generated using mathplotlib
 .
  I'll look up the links you provided and get back to you, if I can't
 figure
  it out. :)

 Sure, good luck! :)

 
 
 
 
  On 27 March 2013 12:12, Amit Saha amitsaha...@gmail.com wrote:
 
  On Wed, Mar 27, 2013 at 4:36 PM, Sayan Chatterjee
  sayanchatter...@gmail.com wrote:
   Thanks a lot for your prompt reply.
  
   1. Yes. This is exactly what I wanted. Creating a bunch of data sets
 and
   then writing script to plot them using gnuplot, but if something can
   produce
   directly 'plots' it will certainly be helpful.
 
  Yes, indeed it is possible. You may want to explore matplotlib a bit.
  You can start with this tutorial [1].
 
  [1] http://www.loria.fr/~rougier/teaching/matplotlib/
 
  
   2. Yes. By stitching them up I meant an animation.Sorry for the
   ambiguity.
   Exactly how we can do it Octave.
  
   Pls see this link:
   http://www.krizka.net/2009/11/06/creating-animations-with-octave/
 
  Right, yes, if you see it uses mencoder/ffmpeg to create the
  animation. So, if you save your individual plots and then use one of
  these tools, you should be able to get the animation done.
 
  Matplotlib itself seems to have some Animated plotting capabilities,
  but I haven't had any experience with them.
 
 
  Best,
  Amit.
 
 
  --
  http://amitsaha.github.com/
 
 
 
 
  --
 
 
 
 --
  Sayan  Chatterjee
  Dept. of Physics and Meteorology
  IIT Kharagpur
  Lal Bahadur Shastry Hall of Residence
  Room AB 205
  Mob: +91 9874513565
  blog: www.blissprofound.blogspot.com
 
  Volunteer , Padakshep
  www.padakshep.org



 --
 http://amitsaha.github.com/




-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Joel Goldstick
On Wed, Mar 27, 2013 at 11:59 AM, Sayan Chatterjee 
sayanchatter...@gmail.com wrote:

 Hi Amit,

 fo = fopen('fname','r+')
 fo.write(%d   %d,j,counter)


 Is giving the following error:

 File ZA.py, line 30, in module
 fo = open('fname','r+')
 IOError: [Errno 2] No such file or directory: 'fname'

 Where is the mistake?


Where is the file called 'fname'?  It must exist and  be in the current
directory


 Cheers,
 Sayan






 On 27 March 2013 12:20, Amit Saha amitsaha...@gmail.com wrote:

 On Wed, Mar 27, 2013 at 4:49 PM, Sayan Chatterjee
 sayanchatter...@gmail.com wrote:
  Yes, ffmpeg will do if multiple plots can be generated using
 mathplotlib .
  I'll look up the links you provided and get back to you, if I can't
 figure
  it out. :)

 Sure, good luck! :)


 
 
 
 
  On 27 March 2013 12:12, Amit Saha amitsaha...@gmail.com wrote:
 
  On Wed, Mar 27, 2013 at 4:36 PM, Sayan Chatterjee
  sayanchatter...@gmail.com wrote:
   Thanks a lot for your prompt reply.
  
   1. Yes. This is exactly what I wanted. Creating a bunch of data sets
 and
   then writing script to plot them using gnuplot, but if something can
   produce
   directly 'plots' it will certainly be helpful.
 
  Yes, indeed it is possible. You may want to explore matplotlib a bit.
  You can start with this tutorial [1].
 
  [1] http://www.loria.fr/~rougier/teaching/matplotlib/
 
  
   2. Yes. By stitching them up I meant an animation.Sorry for the
   ambiguity.
   Exactly how we can do it Octave.
  
   Pls see this link:
   http://www.krizka.net/2009/11/06/creating-animations-with-octave/
 
  Right, yes, if you see it uses mencoder/ffmpeg to create the
  animation. So, if you save your individual plots and then use one of
  these tools, you should be able to get the animation done.
 
  Matplotlib itself seems to have some Animated plotting capabilities,
  but I haven't had any experience with them.
 
 
  Best,
  Amit.
 
 
  --
  http://amitsaha.github.com/
 
 
 
 
  --
 
 
 
 --
  Sayan  Chatterjee
  Dept. of Physics and Meteorology
  IIT Kharagpur
  Lal Bahadur Shastry Hall of Residence
  Room AB 205
  Mob: +91 9874513565
  blog: www.blissprofound.blogspot.com
 
  Volunteer , Padakshep
  www.padakshep.org



 --
 http://amitsaha.github.com/




 --


 --
 *Sayan  Chatterjee*
 Dept. of Physics and Meteorology
 IIT Kharagpur
 Lal Bahadur Shastry Hall of Residence
 Room AB 205
 Mob: +91 9874513565
 blog: www.blissprofound.blogspot.com

 Volunteer , Padakshep
 www.padakshep.org

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor




-- 
Joel Goldstick
http://joelgoldstick.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Walter Prins
Hello,

On 27 March 2013 15:59, Sayan Chatterjee sayanchatter...@gmail.com wrote:

 Hi Amit,

 fo = fopen('fname','r+')
 fo.write(%d   %d,j,counter)


 Is giving the following error:

 File ZA.py, line 30, in module
 fo = open('fname','r+')
 IOError: [Errno 2] No such file or directory: 'fname'

 Where is the mistake?


You are trying to open a file named literally fname due to putting it in
quotes, you probably want to drop the quotes.

Walter
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Sayan Chatterjee
for t in range(0,200):
  fname = 'file_' + str(t)

So it will assign fname values file_0, file_1 so on. Dropping the quotes is
giving me

IOError: [Errno 2] No such file or directory: 'file_0'


Indeed the file is not present. In C we write,if we have to record data in
a file

FILE *fp

fp = fopen(file.dat,w)


Here I want to write different data sets in files having different name i.e
I want to create the files with the data sets. I am quite new to Python, so
you can assume zero knowledge while answering. Thanks for your support. :)


On 27 March 2013 21:38, Walter Prins wpr...@gmail.com wrote:

 Hello,

 On 27 March 2013 15:59, Sayan Chatterjee sayanchatter...@gmail.comwrote:

 Hi Amit,

 fo = fopen('fname','r+')
 fo.write(%d   %d,j,counter)


 Is giving the following error:

 File ZA.py, line 30, in module
 fo = open('fname','r+')
 IOError: [Errno 2] No such file or directory: 'fname'

 Where is the mistake?


 You are trying to open a file named literally fname due to putting it in
 quotes, you probably want to drop the quotes.

 Walter




-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Sayan Chatterjee
Putting w instead of r+ probably solves the problem. The error is not
showing now.


On 27 March 2013 21:47, Sayan Chatterjee sayanchatter...@gmail.com wrote:

 for t in range(0,200):
   fname = 'file_' + str(t)

 So it will assign fname values file_0, file_1 so on. Dropping the quotes
 is giving me

 IOError: [Errno 2] No such file or directory: 'file_0'


 Indeed the file is not present. In C we write,if we have to record data in
 a file

 FILE *fp

 fp = fopen(file.dat,w)


 Here I want to write different data sets in files having different name
 i.e I want to create the files with the data sets. I am quite new to
 Python, so you can assume zero knowledge while answering. Thanks for your
 support. :)


 On 27 March 2013 21:38, Walter Prins wpr...@gmail.com wrote:

 Hello,

 On 27 March 2013 15:59, Sayan Chatterjee sayanchatter...@gmail.comwrote:

 Hi Amit,

 fo = fopen('fname','r+')
 fo.write(%d   %d,j,counter)


 Is giving the following error:

 File ZA.py, line 30, in module
 fo = open('fname','r+')
 IOError: [Errno 2] No such file or directory: 'fname'

 Where is the mistake?


 You are trying to open a file named literally fname due to putting it
 in quotes, you probably want to drop the quotes.

 Walter




 --


 --
 *Sayan  Chatterjee*
 Dept. of Physics and Meteorology
 IIT Kharagpur
 Lal Bahadur Shastry Hall of Residence
 Room AB 205
 Mob: +91 9874513565
 blog: www.blissprofound.blogspot.com

 Volunteer , Padakshep
 www.padakshep.org




-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Bod Soutar
You were opening the file for reading, rather than writing. It
therefore was expecting to find a file.
Change
fo = open('fname','r+')
to
fo = open('fname','w')

Bodsda

On 27 March 2013 16:17, Sayan Chatterjee sayanchatter...@gmail.com wrote:
 for t in range(0,200):
   fname = 'file_' + str(t)

 So it will assign fname values file_0, file_1 so on. Dropping the quotes is
 giving me

 IOError: [Errno 2] No such file or directory: 'file_0'


 Indeed the file is not present. In C we write,if we have to record data in a
 file

 FILE *fp

 fp = fopen(file.dat,w)


 Here I want to write different data sets in files having different name i.e
 I want to create the files with the data sets. I am quite new to Python, so
 you can assume zero knowledge while answering. Thanks for your support. :)


 On 27 March 2013 21:38, Walter Prins wpr...@gmail.com wrote:

 Hello,

 On 27 March 2013 15:59, Sayan Chatterjee sayanchatter...@gmail.com
 wrote:

 Hi Amit,

 fo = fopen('fname','r+')
 fo.write(%d   %d,j,counter)


 Is giving the following error:

 File ZA.py, line 30, in module
 fo = open('fname','r+')
 IOError: [Errno 2] No such file or directory: 'fname'

 Where is the mistake?


 You are trying to open a file named literally fname due to putting it in
 quotes, you probably want to drop the quotes.

 Walter




 --


 --
 Sayan  Chatterjee
 Dept. of Physics and Meteorology
 IIT Kharagpur
 Lal Bahadur Shastry Hall of Residence
 Room AB 205
 Mob: +91 9874513565
 blog: www.blissprofound.blogspot.com

 Volunteer , Padakshep
 www.padakshep.org

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Sayan Chatterjee
Oh yes, thanks. That worked. :)


On 27 March 2013 21:58, Bod Soutar bod...@googlemail.com wrote:

 You were opening the file for reading, rather than writing. It
 therefore was expecting to find a file.
 Change
 fo = open('fname','r+')
 to
 fo = open('fname','w')

 Bodsda

 On 27 March 2013 16:17, Sayan Chatterjee sayanchatter...@gmail.com
 wrote:
  for t in range(0,200):
fname = 'file_' + str(t)
 
  So it will assign fname values file_0, file_1 so on. Dropping the quotes
 is
  giving me
 
  IOError: [Errno 2] No such file or directory: 'file_0'
 
 
  Indeed the file is not present. In C we write,if we have to record data
 in a
  file
 
  FILE *fp
 
  fp = fopen(file.dat,w)
 
 
  Here I want to write different data sets in files having different name
 i.e
  I want to create the files with the data sets. I am quite new to Python,
 so
  you can assume zero knowledge while answering. Thanks for your support.
 :)
 
 
  On 27 March 2013 21:38, Walter Prins wpr...@gmail.com wrote:
 
  Hello,
 
  On 27 March 2013 15:59, Sayan Chatterjee sayanchatter...@gmail.com
  wrote:
 
  Hi Amit,
 
  fo = fopen('fname','r+')
  fo.write(%d   %d,j,counter)
 
 
  Is giving the following error:
 
  File ZA.py, line 30, in module
  fo = open('fname','r+')
  IOError: [Errno 2] No such file or directory: 'fname'
 
  Where is the mistake?
 
 
  You are trying to open a file named literally fname due to putting it
 in
  quotes, you probably want to drop the quotes.
 
  Walter
 
 
 
 
  --
 
 
 
 --
  Sayan  Chatterjee
  Dept. of Physics and Meteorology
  IIT Kharagpur
  Lal Bahadur Shastry Hall of Residence
  Room AB 205
  Mob: +91 9874513565
  blog: www.blissprofound.blogspot.com
 
  Volunteer , Padakshep
  www.padakshep.org
 
  ___
  Tutor maillist  -  Tutor@python.org
  To unsubscribe or change subscription options:
  http://mail.python.org/mailman/listinfo/tutor
 




-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Peter Otten
Sayan Chatterjee wrote:

 for t in range(0,200):
   fname = 'file_' + str(t)
 
 So it will assign fname values file_0, file_1 so on. Dropping the quotes
 is giving me
 
 IOError: [Errno 2] No such file or directory: 'file_0'
 
 
 Indeed the file is not present. In C we write,if we have to record data in
 a file
 
 FILE *fp
 
 fp = fopen(file.dat,w)
 
 
 Here I want to write different data sets in files having different name
 i.e I want to create the files with the data sets. I am quite new to
 Python, so you can assume zero knowledge while answering. Thanks for your
 support. :)

If you try to open a non-existent file in r+ mode in C you should get an 
error, too. The following C code

FILE * f;
int i;
char filename[100];

for (i=0; i10; i++) {
sprintf(filename, foo%d.dat, i);
FILE * f = fopen(filename, w);
/* write stuff to file */
...
fclose(f);
}

translates into this piece of Python:

for i in range(10):
filename = foo%d.dat % i
with open(filename, w) as f:
# write stuff to file
...


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help with installing and/or running PyNomo

2013-03-23 Thread Alan Gauld

On 23/03/13 22:35, Edythe Thompson wrote:

Using Python 2.6.5
Mac OS X version 10.6.8

I want to run the PyNomo package that uses python.


This list is for learning core Python so you are probably better off 
asking on a PyNomo forum or mailing list. Or at the very least the 
MacPython list.


However,


Python 2.7.1 (r271:86882M, Nov 30 2010, 10:35:34)


This is running Python 2.7 not the 2.6 that you installed.

This os probably because your MacOS has python 2.7 installed by default.
You will maybe need to explicitly run  the 2.6 version for PyNomo.


Traceback (most recent call last):
   File /Users/edythethompson/Desktop/Type8-Sample.py, line 3, in module
 from pynomo.nomographer import *
ImportError: No module named pynomo.nomographer
 


I have no idea what PyNomo is or how it works so thats a guess but there 
is also a danger that some of your other packages have installed 
themselves in the wrong Python so some may be inPython 2.6 and others in 
2.7! That's a pure guess...


But what the error says is that python 2.7 doesn't know what/where 
PyNomo is.


My best advice is to see if there is a Python 2./7 version available and 
if so install that instead. Failing that check that all your installs 
have been in the 2.6 area and then run Python2.6 (create a shortcut to 
the executable)


Finally your paste suggests you are actually running Python within IDLE. 
That may not be the best thing to do when using 3rd party packages like 
PyNomo.


Again check with a PyNomo forum (or the developer if there is
no forum)


HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with iterators

2013-03-21 Thread Mitya Sirenef

On 03/21/2013 08:39 PM, Matthew Johnson wrote:

Dear list,


 I have been trying to understand out how to use iterators and in
 particular groupby statements. I am, however, quite lost.

 I wish to subset the below list, selecting the observations that have
 an ID ('realtime_start') value that is greater than some date (i've
 used the variable name maxDate), and in the case that there is more
 than one such record, returning only the one that has the largest ID
 ('realtime_start').

 The code below does the job, however i have the impression that it
 might be done in a more python way using iterators and groupby
 statements.

 could someone please help me understand how to go from this code to
 the pythonic idiom?

 thanks in advance,

 Matt Johnson

 _

 ## Code example

 import pprint

 obs = [{'date': '2012-09-01',
 'realtime_end': '2013-02-18',
 'realtime_start': '2012-10-15',
 'value': '231.951'},
 {'date': '2012-09-01',
 'realtime_end': '2013-02-18',
 'realtime_start': '2012-11-15',
 'value': '231.881'},
 {'date': '2012-10-01',
 'realtime_end': '2013-02-18',
 'realtime_start': '2012-11-15',
 'value': '231.751'},
 {'date': '2012-10-01',
 'realtime_end': '-12-31',
 'realtime_start': '2012-12-19',
 'value': '231.623'},
 {'date': '2013-02-01',
 'realtime_end': '-12-31',
 'realtime_start': '2013-03-21',
 'value': '231.157'},
 {'date': '2012-11-01',
 'realtime_end': '2013-02-18',
 'realtime_start': '2012-12-14',
 'value': '231.025'},
 {'date': '2012-11-01',
 'realtime_end': '-12-31',
 'realtime_start': '2013-01-19',
 'value': '231.071'},
 {'date': '2012-12-01',
 'realtime_end': '2013-02-18',
 'realtime_start': '2013-01-16',
 'value': '230.979'},
 {'date': '2012-12-01',
 'realtime_end': '-12-31',
 'realtime_start': '2013-02-19',
 'value': '231.137'},
 {'date': '2012-12-01',
 'realtime_end': '-12-31',
 'realtime_start': '2013-03-19',
 'value': '231.197'},
 {'date': '2013-01-01',
 'realtime_end': '-12-31',
 'realtime_start': '2013-02-21',
 'value': '231.198'},
 {'date': '2013-01-01',
 'realtime_end': '-12-31',
 'realtime_start': '2013-03-21',
 'value': '231.222'}]

 maxDate = 2013-03-21

 dobs = dict([(d, []) for d in set([e['date'] for e in obs])])

 for o in obs:
 dobs[o['date']].append(o)

 dobs_subMax = dict([(k, [d for d in v if d['realtime_start'] = maxDate])
 for k, v in dobs.items()])

 rts = lambda x: x['realtime_start']

 mmax = [sorted(e, key=rts)[-1] for e in dobs_subMax.values() if e]

 mmax.sort(key = lambda x: x['date'])

 pprint.pprint(mmax)
 ___
 Tutor maillist - Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor



You can do it with groupby like so:


from itertools import groupby
from operator import itemgetter


maxDate = 2013-03-21
mmax= list()

obs.sort(key=itemgetter('date'))

for k, group in groupby(obs, key=itemgetter('date')):
group = [dob for dob in group if dob['realtime_start'] = maxDate]
if group:
group.sort(key=itemgetter('realtime_start'))
mmax.append(group[-1])

pprint.pprint(mmax)


Note that writing multiply-nested comprehensions like you did results in
very unreadable code. Do you find this code more readable?

 -m


--
Lark's Tongue Guide to Python: http://lightbird.net/larks/

Many a man fails as an original thinker simply because his memory it too
good.  Friedrich Nietzsche

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with iterators

2013-03-21 Thread Steven D'Aprano

On 22/03/13 11:39, Matthew Johnson wrote:

Dear list,

I have been trying to understand out how to use iterators and in
particular groupby statements.  I am, however, quite lost.


groupby is a very specialist function which is not very intuitive to
use. Sometimes I think that groupby is an excellent solution in search
of a problem.



I wish to subset the below list, selecting the observations that have
an ID ('realtime_start') value that is greater than some date (i've
used the variable name maxDate), and in the case that there is more
than one such record, returning only the one that has the largest ID
('realtime_start').



The code that you show does not so what you describe here. The most
obvious difference is that it doesn't return or display a single record,
but shows multiple records.

In your case, it selects six records, four of which have a realtime_start
that occurs BEFORE the given maxDate.

To solve the problem you describe here, of finding at most a single
record, the solution is much simpler than what you have done. Prepare a
list of observations, sorted by realtime_start. Take the latest such
observation. If the realtime_start is greater than the maxDate, you have
your answer. If not, there is no answer.

The simplest solution is usually the best. The simpler your code, the fewer
bugs it will contain.


obs.sort(key=lambda rec: rec['realtime_start'])
rec = obs[-1]
if rec['realtime_start']  maxDate:
print rec
else:
print no record found


which prints:

{'date': '2013-01-01', 'realtime_start': '2013-03-21', 'realtime_end': 
'-12-31', 'value': '231.222'}




--
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with iterators

2013-03-21 Thread Steven D'Aprano

On 22/03/13 12:39, Mitya Sirenef wrote:


You can do it with groupby like so:


from itertools import groupby
from operator import itemgetter

maxDate = 2013-03-21
mmax= list()

obs.sort(key=itemgetter('date'))

for k, group in groupby(obs, key=itemgetter('date')):
 group = [dob for dob in group if dob['realtime_start'] = maxDate]
 if group:
 group.sort(key=itemgetter('realtime_start'))
 mmax.append(group[-1])

pprint.pprint(mmax)



This suffers from the same problem of finding six records instead of one,
and that four of the six have start dates before the given date instead
of after it.

Here's another solution that finds all the records that start on or after
the given data (the poorly named maxDate) and displays them sorted by
date.


selected = [rec for rec in obs if rec['realtime_start'] = maxDate]
selected.sort(key=lambda rec: rec['date'])
print selected




--
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with iterators

2013-03-21 Thread Mitya Sirenef

On 03/21/2013 10:20 PM, Steven D'Aprano wrote:

On 22/03/13 12:39, Mitya  Sirenef wrote:


 You can do it with groupby like so:


 from itertools import groupby
 from operator import itemgetter

 maxDate = 2013-03-21
 mmax = list()

 obs.sort(key=itemgetter('date'))

 for k, group in groupby(obs, key=itemgetter('date')):
 group = [dob for dob in group if dob['realtime_start'] = maxDate]
 if group:
 group.sort(key=itemgetter('realtime_start'))
 mmax.append(group[-1])

 pprint.pprint(mmax)


 This suffers from the same problem of finding six records instead of one,
 and that four of the six have start dates before the given date instead
 of after it.


OP said his code produces the needed result and I think his description
probably doesn't match what he really intends to do (he also said he
wants the same code rewritten using groupby). I reproduced the logic of
his code... hopefully he can step in and clarify!






 Here's another solution that finds all the records that start on or after
 the given data (the poorly named maxDate) and displays them sorted by
 date.


 selected = [rec for rec in obs if rec['realtime_start'] = maxDate]
 selected.sort(key=lambda rec: rec['date'])
 print selected






--
Lark's Tongue Guide to Python: http://lightbird.net/larks/

A little bad taste is like a nice dash of paprika.
Dorothy Parker

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help related to unicode using python

2013-03-20 Thread Mark Lawrence

On 20/03/2013 11:38, nishitha reddy wrote:

Hi all
i'm working with unicode using python
i have some txt files in telugu i want to split all the lines of that
text files in to words of telugu
and i need to classify  all of them using some identifiers.can any one
send solution for that
 thank u
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



Sorry but we don't work like that.  You write some code and when you get 
problems ask for help.


I'd strongly suggest using Python 3.3 if you can for your processing. 
It's vastly superior to earlier, buggy unicode implementations in Python.


--
Cheers.

Mark Lawrence

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help related to unicode using python

2013-03-20 Thread Steven D'Aprano

On 20/03/13 22:38, nishitha reddy wrote:

Hi all
i'm working with unicode using python
i have some txt files in telugu i want to split all the lines of that
text files in to words of telugu
and i need to classify  all of them using some identifiers.can any one
send solution for that



Probably not. I would be surprised if anyone here knows what Telugu is,
or the rules for splitting Telugu text into words. The Natural Language
Toolkit (NLTK) may be able to handle it.

You could try doing the splitting and classifying yourself. If Telugu uses
space-delimited words like English, you can do it easily:

data = uఏఐఒ ఓఔక ఞతణథ
words = data.split()

As for classifying the words, I have no idea, sorry.


--
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help

2013-03-20 Thread Robert Sjoblom
 Hello, I am a beginning python student and I am having trouble with a
 program I am writing.
Hello, and welcome. Since you don't say if this is an assignment or
not, I will just point you in the right direction, and point out a few
things you might make use of.

 def B1():
  period = .

You don't actually need to store a period anywhere, because when your
while loop initiates, you can just do:
while next1 != .
A word of advice: next is a keyword in python, so 'next1' might not be
a great variable name.

  # I need store the value so when while overwrites next1 with the next input
 the previous input is stored and will print output when I call it later
 along with last one
  # I believe the solution is some how implenting this expression x = x+
 variable
  while  next1 != (period) :

 next1  = input(Enter the next word in you sentence or enter period:)

 if next1 == (period):
 next1 = next1 + period
 print (Your sentence is:,first,next1,period)

Your code will never terminate, because:
program initiates. while loop begins.
Enter a few words, then decide to end with a period.
if-branch executes, because next1 is a period.
next1 becomes next1 + period #which is ..
while loop checks to see if next1 is a period, which it isn't, and runs again.

Furthermore, you are continually overwriting next1 until you type a
period. Consider the following output (I have added some spaces to the
important parts, so as to make them stand out):

Enter the first word in your sentence I
Enter the next word in you sentence or enter period:am
Entering while loop. next1 is: am
Enter the next word in you sentence or enter period:a
next1 is: a
Entering while loop. next1 is: a
Enter the next word in you sentence or enter period:novice
next1 is: novice
Entering while loop. next1 is: novice
Enter the next word in you sentence or enter period:.
next1 is: .
next1 is a period, now running next1 + period line:
..
Entering while loop. next1 is: ..

If you don't have to use strings for this program, I would suggest you
check out lists, and especially list.append(). It is possible to write
a program that does what you want, but it'd be a convoluted solution.

-- 
best regards,
Robert S.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help

2013-03-20 Thread Dave Angel

On 03/20/2013 03:57 PM, travis jeanfrancois wrote:

Hello, I am a beginning python student and I am having trouble with a
program I am writing  . The problem requires me to use while and that I
create a function that allows the user to a create sentence by  inputing  a
string and to end the sentence with a  period meaning inputing . .The
problem is while keeps overwriting the previuos input and it still asks for
a string even after it prints out  .

Here is the output I am getting


Enter the first word in your sentence: I
Enter the next word in your sentence: am
Enter the next word in your sentence: a
Enter the next word in your sentence: novice
Enter the next word in your sentence: .
I . .
Enter the next word in your sentence:


Here is the desired output:
   :
Enter the first word in your sentence: I
Enter the next word in your sentence: am
Enter the next word in your sentence: a
Enter the next word in your sentence: novice
Enter the next word in your sentence: .
I am a novice.

Here is my code:





def B1():
  #Creates a function called B1
  period = .
  # The variable period is assigned
  first = input(Enter the first word in your sentence )
  #The variable first is assigned
  next1 = input(Enter the next word in you sentence or enter period:)
  #The variable next 1 is assigned

  # I need store the value so when while overwrites next1 with the next
input the previous input is stored and will print output when I call it
later along with last one
  # I believe the solution is some how implenting this expression x = x+
variable


You need a new variable that accumulates the whole sentence.  I'd use a 
list, but many people would use a string.  Since I don't know what 
concepts you know yet, I'll stick to string here.  Anyway, you have to 
initialize it before the loop, and then you can print it after the loop.


sentence = 



  while  next1 != (period) :

 next1  = input(Enter the next word in you sentence or enter period:)


At this point, add the word to the sentence.


 if next1 == (period):
 next1 = next1 + period
 print (Your sentence is:,first,next1,period)


No need for these three lines inside the loop, since the loop will end 
when next1 is equal to the period.  So put the print after the end of 
the loop, and I'll let you figure out what it should print.




PS : The #  is I just type so I can understand what each line does




--
DaveA
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help

2013-03-20 Thread xDog Walker
On Wednesday 2013 March 20 13:39, Robert Sjoblom wrote:
 A word of advice: next is a keyword in python

~/Packages/Python/Notable-0.1.5b python
Python 2.5 (r25:51908, May 25 2007, 16:14:04)
[GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2
Type help, copyright, credits or license for more information.
 import keyword
 keyword.iskeyword('next')
False

14:44 Wed 2013 Mar 20
~/Packages/Python/Notable-0.1.5b python2.7
Python 2.7.2 (default, Oct 10 2011, 10:47:36)
[GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2
Type help, copyright, credits or license for more information.
 import keyword
 keyword.iskeyword('next')
False

14:44 Wed 2013 Mar 20
~/Packages/Python/Notable-0.1.5b python3.3
Python 3.3.0 (default, Sep 30 2012, 09:02:56)
[GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux
Type help, copyright, credits or license for more information.
 import keyword
 keyword.iskeyword('next')
False


-- 
Yonder nor sorghum stenches shut ladle gulls stopper torque wet 
strainers.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help

2013-03-20 Thread Robert Sjoblom
On Mar 20, 2013 10:49 p.m., xDog Walker thud...@gmail.com wrote:

 On Wednesday 2013 March 20 13:39, Robert Sjoblom wrote:
  A word of advice: next is a keyword in python

 ~/Packages/Python/Notable-0.1.5b python
 Python 2.5 (r25:51908, May 25 2007, 16:14:04)
 [GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2
 Type help, copyright, credits or license for more information.
  import keyword
  keyword.iskeyword('next')
 False
 
 14:44 Wed 2013 Mar 20
 ~/Packages/Python/Notable-0.1.5b python2.7
 Python 2.7.2 (default, Oct 10 2011, 10:47:36)
 [GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2
 Type help, copyright, credits or license for more information.
  import keyword
  keyword.iskeyword('next')
 False
 
 14:44 Wed 2013 Mar 20
 ~/Packages/Python/Notable-0.1.5b python3.3
 Python 3.3.0 (default, Sep 30 2012, 09:02:56)
 [GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux
 Type help, copyright, credits or license for more information.
  import keyword
  keyword.iskeyword('next')
 False
 

 --
 Yonder nor sorghum stenches shut ladle gulls stopper torque wet
 strainers.
Fine, it's a method, my bad.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help

2013-03-20 Thread Alan Gauld

On 20/03/13 19:57, travis jeanfrancois wrote:

I create a function that allows the user to a create sentence by
  inputing  a string and to end the sentence with a  period meaning
inputing . .The problem is while keeps overwriting the previuos input


'While' does not do any such thing. Your code is doing that all by 
itself. What while does is repeat your code until a condition

becomes false or you explicitly break out of the loop.


Here is my code:

def B1():


Try to give your functions names that describe what they do.
B1() is meaningless, readSentence() would be better.



  period = .
  # The variable period is assigned


Its normal programming practice to put the comment above
the code not after it. Also comments should indicate why you
are doing something not what you are doing - we can see that
from the code.


  first = input(Enter the first word in your sentence )
  next1 = input(Enter the next word in you sentence or enter period:)



  # I need store the value so when while overwrites next1 with the next
input the previous input is stored and will print output when I call it
later along with last one
  # I believe the solution is some how implenting this expression x = x+
variable


You could be right. Addition works for strings as well as numbers.
Although there are other (better) options but you may not have covered 
them in your class yet.



  while  next1 != (period) :


You don;t need the parentheses around period.
Also nextWord might be a better name than next1.
Saving 3 characters of typing is not usually worthwhile.


 next1  = input(Enter the next word in you sentence or enter period:)


Right, here you are overwriting next1. It's not the while's
fault - it is just repeating your code. It is you who are
overwriting the variable.

Notice that you are not using the first that you captured?
Maybe you should add next1 to first at some point? Then you
can safely overwrite next1 as much as you like?


 if next1 == (period):


Again you don;t need the parentheses around period


 next1 = next1 + period


Here, you add the period to next1 which the 'if' has
already established is now a period.


 print (Your sentence is:,first,next1,period)


And now you print out the first word plus next1 (= 2 periods) plus a 
period = 3 periods in total... preceded by the phrase Your sentence 
is: This tells us that the sample output you posted is not from this 
program... Always match the program and the output when debugging or you 
will be led seriously astray!



PS : The #  is I just type so I can understand what each line does


The # is a comment marker. Comments are a very powerful tool that 
programmers use to explain to themselves and other programmers

why they have done what they have.

When trying to debug faults like this it is often worthwhile
grabbing a pen and drawing a chart of your variables and
their values after each time round the loop.
In this case it would have looked like

iteration   period  first   next1
0   .   I   am
1   .   I   a
2   .   I   novice
3   .   I   ..

If you aren't sure of the values insert a print statement
and get the program to tell you, but working it out in
your head is more likely to show you the error.


HTH,

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help related to unicode using python

2013-03-20 Thread शंतनू
Reply inline.
On 21/03/13 12:18 AM, Steven D'Aprano wrote:
 On 20/03/13 22:38, nishitha reddy wrote:
 Hi all
 i'm working with unicode using python
 i have some txt files in telugu i want to split all the lines of that
 text files in to words of telugu
 and i need to classify  all of them using some identifiers.can any one
 send solution for that


 Probably not. I would be surprised if anyone here knows what Telugu is,
 or the rules for splitting Telugu text into words. The Natural Language
 Toolkit (NLTK) may be able to handle it.

 You could try doing the splitting and classifying yourself. If Telugu
 uses
 space-delimited words like English, you can do it easily:

 data = uఏఐఒ ఓఔక ఞతణథ
 words = data.split()
Unicode characters for telugu:
http://en.wikipedia.org/wiki/Telugu_alphabet#Unicode


On python 3.x,

 import re
 a='ఏఐఒ ఓఔక ఞతణథ'
 print(a)
ఏఐఒ ఓఔక ఞతణథ
 re.split('[^\u0c01-\u0c7f]', a)
['ఏఐఒ', 'ఓఔక', 'ఞతణథ']

Similar logic can be used for any other Indic script.

HTH.

-- 
शंतनू
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help with itertools.izip_longest

2013-03-16 Thread Oscar Benjamin
On 16 March 2013 21:14, Abhishek Pratap abhishek@gmail.com wrote:
 Hey Guys

 I am trying to use itertools.izip_longest to read a large file in
 chunks based on the examples I was able to find on the web. However I
 am not able to understand the behaviour of the following python code.
 (contrived form of example)

 for x in itertools.izip_longest(*[iter([1,2,3])]*2):
 print x


 ###output:
 (1, 2)
 (3, None)


 It gives me the right answer but I am not sure how it is doing it. I
 also referred to the itertools doc but could not comprehend much. In
 essence I am trying to understand the intracacies of the following
 documentation from the itertools package.

 The left-to-right evaluation order of the iterables is guaranteed.
 This makes possible an idiom for clustering a data series into
 n-length groups using izip(*[iter(s)]*n).

 How is *n able to group the data and the meaning of '*' in the
 beginning just after izip.

The '*n' part is to multiply the list so that it repeats. This works
for most sequence types in Python:

 a = [1,2,3]
 a * 2
[1, 2, 3, 1, 2, 3]

In this particular case we multiply a list containing only one item,
the iterator over s. This means that the new list contains the same
element twice:
 it = iter(a)
 [it]
[listiterator object at 0x166c990]
 [it] * 2
[listiterator object at 0x166c990, listiterator object at 0x166c990]

So if every element of the list is the same iterator, then we can call
next() on any of them to get the same values in the same order:
 d = [it]*2
 d
[listiterator object at 0x166c990, listiterator object at 0x166c990]
 next(d[1])
1
 next(d[0])
2
 next(d[0])
3
 next(d[0])
Traceback (most recent call last):
  File stdin, line 1, in module
StopIteration
 next(d[1])
Traceback (most recent call last):
  File stdin, line 1, in module
StopIteration

The * just after izip is for argument unpacking. This allows you to
call a function with arguments unpacked from a list:

 def f(x, y):
... print('x is %s' % x)
... print('y is %s' % y)
...
 f(1, 2)
x is 1
y is 2
 args = [1,2]
 f(args)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: f() takes exactly 2 arguments (1 given)
 f(*args)
x is 1
y is 2

So the original expression, izip(*[iter(s)]*2), is another way of writing

it = iter(s)
izip(it, it)

And izip(*[iter(s)]*10) is equivalent to

izip(it, it, it, it, it, it, it, it, it, it)

Obviously writing it out like this will get a bit unwieldy if we want
to do izip(*[iter(s)]*100) so the preferred method is
izip(*[iter(s)]*n) which also allows us to choose what value to give
for n without changing anything else in the code.


Oscar
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help with itertools.izip_longest

2013-03-16 Thread Abhishek Pratap
On Sat, Mar 16, 2013 at 2:32 PM, Oscar Benjamin
oscar.j.benja...@gmail.com wrote:
 On 16 March 2013 21:14, Abhishek Pratap abhishek@gmail.com wrote:
 Hey Guys

 I am trying to use itertools.izip_longest to read a large file in
 chunks based on the examples I was able to find on the web. However I
 am not able to understand the behaviour of the following python code.
 (contrived form of example)

 for x in itertools.izip_longest(*[iter([1,2,3])]*2):
 print x


 ###output:
 (1, 2)
 (3, None)


 It gives me the right answer but I am not sure how it is doing it. I
 also referred to the itertools doc but could not comprehend much. In
 essence I am trying to understand the intracacies of the following
 documentation from the itertools package.

 The left-to-right evaluation order of the iterables is guaranteed.
 This makes possible an idiom for clustering a data series into
 n-length groups using izip(*[iter(s)]*n).

 How is *n able to group the data and the meaning of '*' in the
 beginning just after izip.

 The '*n' part is to multiply the list so that it repeats. This works
 for most sequence types in Python:

 a = [1,2,3]
 a * 2
 [1, 2, 3, 1, 2, 3]

 In this particular case we multiply a list containing only one item,
 the iterator over s. This means that the new list contains the same
 element twice:
 it = iter(a)
 [it]
 [listiterator object at 0x166c990]
 [it] * 2
 [listiterator object at 0x166c990, listiterator object at 0x166c990]

 So if every element of the list is the same iterator, then we can call
 next() on any of them to get the same values in the same order:
 d = [it]*2
 d
 [listiterator object at 0x166c990, listiterator object at 0x166c990]
 next(d[1])
 1
 next(d[0])
 2
 next(d[0])
 3
 next(d[0])
 Traceback (most recent call last):
   File stdin, line 1, in module
 StopIteration
 next(d[1])
 Traceback (most recent call last):
   File stdin, line 1, in module
 StopIteration

 The * just after izip is for argument unpacking. This allows you to
 call a function with arguments unpacked from a list:

 def f(x, y):
 ... print('x is %s' % x)
 ... print('y is %s' % y)
 ...
 f(1, 2)
 x is 1
 y is 2
 args = [1,2]
 f(args)
 Traceback (most recent call last):
   File stdin, line 1, in module
 TypeError: f() takes exactly 2 arguments (1 given)
 f(*args)
 x is 1
 y is 2

 So the original expression, izip(*[iter(s)]*2), is another way of writing

 it = iter(s)
 izip(it, it)

 And izip(*[iter(s)]*10) is equivalent to

 izip(it, it, it, it, it, it, it, it, it, it)

 Obviously writing it out like this will get a bit unwieldy if we want
 to do izip(*[iter(s)]*100) so the preferred method is
 izip(*[iter(s)]*n) which also allows us to choose what value to give
 for n without changing anything else in the code.


 Oscar


Thanks a bunch Oscar. This is why I love this community. It is
absolutely clear now. It is funny I am getting the solution over the
mailing list while I am at pycon :)


best,
-Abhi
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help with itertools.izip_longest

2013-03-16 Thread Peter Otten
Abhishek Pratap wrote:

 I am trying to use itertools.izip_longest to read a large file in
 chunks based on the examples I was able to find on the web. However I
 am not able to understand the behaviour of the following python code.
 (contrived form of example)
 
 
 
 for x in itertools.izip_longest(*[iter([1,2,3])]*2):
 print x
 
 
 ###output:
 (1, 2)
 (3, None)
 
 
 It gives me the right answer but I am not sure how it is doing it. I
 also referred to the itertools doc but could not comprehend much. In
 essence I am trying to understand the intracacies of the following
 documentation from the itertools package.
 
 The left-to-right evaluation order of the iterables is guaranteed.
 This makes possible an idiom for clustering a data series into
 n-length groups using izip(*[iter(s)]*n).
 
 How is *n able to group the data and the meaning of '*' in the
 beginning just after izip.

Break the expression into smaller chunks:

items = [1, 2, 3]
it = iter(items)
args = [it] * 2 # same as [it, it]
chunks = itertools.izip_longest(*args) # same as izip_longest(it, it)

As a consequence of passing the same iterator twice getting the first item 
from the first iterator will advance the second iterator (which is 
actually the same as the first iterator) to the second item which will in 
turn advance the first iterator to the third item. Try to understand the 
implementation given for izip() at

http://docs.python.org/2/library/itertools.html#itertools.izip

before you proceed to izip_longest().

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help with itertools.izip_longest

2013-03-16 Thread Abhishek Pratap
On Sat, Mar 16, 2013 at 2:53 PM, Peter Otten __pete...@web.de wrote:
 Abhishek Pratap wrote:

 I am trying to use itertools.izip_longest to read a large file in
 chunks based on the examples I was able to find on the web. However I
 am not able to understand the behaviour of the following python code.
 (contrived form of example)



 for x in itertools.izip_longest(*[iter([1,2,3])]*2):
 print x


 ###output:
 (1, 2)
 (3, None)


 It gives me the right answer but I am not sure how it is doing it. I
 also referred to the itertools doc but could not comprehend much. In
 essence I am trying to understand the intracacies of the following
 documentation from the itertools package.

 The left-to-right evaluation order of the iterables is guaranteed.
 This makes possible an idiom for clustering a data series into
 n-length groups using izip(*[iter(s)]*n).

 How is *n able to group the data and the meaning of '*' in the
 beginning just after izip.

 Break the expression into smaller chunks:

 items = [1, 2, 3]
 it = iter(items)
 args = [it] * 2 # same as [it, it]
 chunks = itertools.izip_longest(*args) # same as izip_longest(it, it)

 As a consequence of passing the same iterator twice getting the first item
 from the first iterator will advance the second iterator (which is
 actually the same as the first iterator) to the second item which will in
 turn advance the first iterator to the third item. Try to understand the
 implementation given for izip() at


Thanks Peter. I guess I missed the trick on how each iterator will be
moved ahead automatically as the are basically same, replicated N
times.

-Abhi


 http://docs.python.org/2/library/itertools.html#itertools.izip

 before you proceed to izip_longest().

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help

2013-03-13 Thread Alan Gauld

On 13/03/13 15:12, Joshua Wilkerson wrote:

Can you help me with something? This code (it also draws from the
text_game file) says it has a syntax error,



Don't make us guess, post the error message.
It will tell us where.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help

2013-03-13 Thread Oscar Benjamin
On 13 March 2013 15:12, Joshua Wilkerson joshjwilker...@yahoo.com wrote:
 Can you help me with something? This code (it also draws from the text_game
 file) says it has a syntax error, but I can't seem to find what it is, I
 think the code is having a fit but I'm not sure. I'm appreciative to all
 hep.

Could you perhaps copy and paste the entire error message here?
Usually it says the line on which the error occurs, shows that line
and a pointer to where there error is, e.g.:

$ python tmp.py
  File tmp.py, line 9
[count+=1 for n in range()]
   ^
SyntaxError: invalid syntax


Oscar
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help

2013-03-13 Thread Steven D'Aprano

On 14/03/13 02:12, Joshua Wilkerson wrote:

Can you help me with something? This code (it also draws from the text_game 
file) says it has a syntax error, but I can't seem to find what it is, I think 
the code is having a fit but I'm not sure. I'm appreciative to all hep.



The most valuable help we can give you is to teach you to help yourself, and to 
learn what not to do. Here are some Do Nots:

- Do not expect us to read through hundreds of lines of code looking for the 
error.

- Do not expect us to save your files and then run them. We have no idea what 
they will do, you might be trying to trick us into running harmful code. Unless 
we read through all your code and study it carefully, we can't know if it is 
safe.

- Even if we trust you AND trust your code, we're volunteers, not servants. We're only 
going to install your code and run it if you pay us, or if your problem seems so 
interesting that we want to solve the problem no matter how much work it takes. 
Unfortunately, a syntax error does not sound interesting.

- Don't assume that Python is having a fit. Trust me, hundreds of thousands 
or millions of people have used Python for 20+ years now. No software is perfect and bug 
free, but trust me, the chances that you have discovered a bug that nobody before you has 
ever seen is remote. 99.99% of the bugs you experience as a programmer will be bugs in 
*your* code, not the language. (But don't worry, you'll soon learn to fix those bugs so 
quickly you won't even remember them.)


And here are some Dos:


- The most valuable thing you can do right now is learn how to read and 
understand the error messages that Python gives you. There is a lot of 
information buried in them. And usually not buried very deeply, often all you 
need to do is read it and it will tell you what went wrong. (At least once you 
get experiences enough to know how to interpret the error.) Compared to some 
other languages, Python's error messages are a paragon of clarity and 
simplicity.

See below for more on this one.

- If you have trouble with an error that you can't solve yourself, make it easy 
for us to help you:

  * The absolute LEAST you need to do is copy and paste the entire
traceback, starting with the line Traceback (most recent call last)
all the way to the end, including the error message. SyntaxErrors may
not have a Traceback line, but you should still copy and paste the
entire message.

  * Better still, if you can, try to SIMPLIFY the problem to the smallest
amount of code that displays the same error. Nine times out of ten, by
going through this process of simplifying the code, *you* will discover
what the error was, and solve the problem yourself. The tenth time, you
will then have a nice, simple piece of code that you can show us,
instead of hundreds and hundreds of lines that we won't read.

See this website for more detail:

http://sscce.org/

Although it is written for Java programmers, the lessons it gives apply
to any language.

  * Remember to mention what version of Python you are using, and what
operating system. (Windows, Linux, Mac, something else?) If you are
using a less common Python compiler, like IronPython or Jython, say so.
If you are running your code via an IDE like IDLE or IPython, say so.



Now for this specific error. You are getting a SyntaxError. Unfortunately, 
syntax errors sometimes give the least informative error messages in Python. 
But fortunately you can still work out what is wrong:


py for x = range(1, 2):
  File stdin, line 1
for x = range(1, 2):
  ^
SyntaxError: invalid syntax


Notice the small caret ^ on a line on its own? In your email, it may not line up correctly, but if 
you read the error in context, in the Python compiler or IDE where it occurs, it will line up with 
the first thing that Python found that was broken syntax. In this case, you simply cannot use 
assignment, x = something, inside the for line. The right syntax is for x in 
range(1, 20).

Here's another example:


py x = 23*)1+5)
  File stdin, line 1
x = 23*)1+5)
   ^
SyntaxError: invalid syntax


Here the caret should line up under the left-most parenthesis (round bracket). 
The solution is to use the open-bracket, not close-bracket.


A common error is to use too few closing brackets.

py x = 23*(1 + (15 - 7)
... y = x + 1
  File stdin, line 2
y = x + 1
^
SyntaxError: invalid syntax


See what happens here? The error, the missing bracket, is on the *previous* 
line. That's because Python cannot tell that it is truly missing until it gets 
to the next line. So if you have a Syntax Error on a line that looks right, or 
that is a comment, *work backwards*, line by line, until you find something 
that is missing a closing bracket.



--
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:

Re: [Tutor] help with storing money variable

2013-02-19 Thread Dave Angel

On 02/19/2013 07:36 AM, Ghadir Ghasemi wrote:

Hi guys, Iam halfway through my vending machine program that I started earlier. 
I ran into a problem. When the user inserts some money, The money variable is 
not stored for until the user buys an item. So what happens is when the users 
inserts some coins and then trys to buy an item the money they inserted is not 
stored till they buy item.Can you tell me how this can be overcome, so that 
when the user trys to buy an item,the vending machine correctly looks at the 
amount of money they have and vends the item depending on the amound of money 
they have.  Here is the code:



def printMenu():
 print (|__|)
 print (|Menu: |)
 print (|--|)
 print (|  1. Display all Items|)
 print (|  2. Insert 10p   |)
 print (|  3. Insert 20p   |)
 print (|  4. Insert 50p   |)
 print (|  5. Insert £1|)
 print (|  6. Buy an item  |)
 print (|  7. Print Current Amount |)
 print (|  8. Exit |)
 print (|__|)

while True:
 printMenu()
 choice = input(enter an option from the menu: )



 if choice == '1':
 print()
 print( A  BC)
 print(  1.[ Vimtos ] [ Chewits ] [ Mars Bar ])
 print([  50p   ] [  40p] [  50p ])
 print()
 print(  2.[ Doritos ] [ Mentos ])
 print([  60p] [  50p   ])
 print()



 elif choice == '2':
 money = 0
 number = int(input(how many 10p: ))
 money += number * 1/10
 print(your newly updated credit is £ + str(money) + 0)


 elif choice == '3':
 money = 0
 number2  = int(input(how many 20p: ))
 money += number2 * 2/10
 print(your newly updated credit is £ + str(money) + 0)


 elif choice == '4':
 money = 0
 number3 = int(input(how many 50p: ))
 money += number3 * 5/10
 print(your newly updated credit is £ + str(money) + 0)


 elif choice == '5':
 money = 0
 number4 = int(input(how many £1: ))
 money += number4 * 1
 print(your newly updated credit is £ + str(money))



 elif choice == '6':
 code = input(Enter the code of item you want to buy e.g. for Vimtos = a1: 
)
 money = 0
 pricea1 = 0.50
 pricea2 = 0.60
 priceb1 = 0.40
 priceb2 = 0.50
 pricec1 = 0.50

 if code == 'a1':

 if money  pricea1:
 print(you have bought a packet of Vimtos and your newly updated 
balance is  + str(money - pricea1))
 money -= pricea1
 else:
 print(you can't buy that item as your credit is too low)

 if code == 'a2':
 if money  pricea2:
 print(you have bought a packet of Doritos and your newly updated 
balance is + str(money - pricea2))
 money -= pricea2
 else:
 print(you can't buy that item as your credit is too low)

 if code == 'b1':
 if money  priceb1:
 print(you have bought a packet of Chewits and your newly updated 
balance is + str(money - priceb1))
 money -= priceb1
 else:
 print(you can't buy that item as your credit is too low)

 if code == 'b2':
 if money  priceb2:
 print(you have bought a packet of Mentos and your newly updated 
balance is + str(money - pricea2))
 money -= priceb2
 else:
 print(you can't buy that item as your credit is too low)

 if code == 'c1':
 if money  pricec1:
 print(you have bought a Mars Bar and your newly updated balance 
is + str(money - pricea2))
 money -= priceb2
 else:
 print(you can't buy that item as your credit is too low)


How did you conclude that the money they deposit isn't stored till 
they try to buy something?  Are you really saying it isn't visible to 
the user?  Could it be because you forgot the

elif code == 7

case?  (And the 8 one as well.)

The other problem I see is that many of those choices zero the value 
bound to money.  That should be zeroed before the while loop, not 
inside any place somebody deposits something.



--
DaveA
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help with storing money variable

2013-02-19 Thread Alan Gauld

On 19/02/13 12:36, Ghadir Ghasemi wrote:


def printMenu():
 print (|__|)
 print (|  2. Insert 10p   |)
 print (|  3. Insert 20p   |)
 print (|  4. Insert 50p   |)
 print (|__|)

while True:
 elif choice == '2':
 money = 0
 number = int(input(how many 10p: ))
 money += number * 1/10
 elif choice == '3':
 money = 0
 number2  = int(input(how many 20p: ))
 money += number2 * 2/10
 elif choice == '4':
 money = 0
 number3 = int(input(how many 50p: ))
 money += number3 * 5/10


In each case you start by zeroing money thus losing any credit they
had built up. If a real machine did that to me I'd me mighty annoyed.

Just a thought...

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help with inch to cms conversion .

2013-02-11 Thread Dave Angel

On 02/11/2013 11:06 AM, Pravya Reddy wrote:

Can you please help me with the code.

#!/usr/bin/env python

inchtocm.py




First, remove that try/except until the code is free of obvious bugs. 
It's masking where the error actually occurs.  Alternatively, include a 
variable there, and print the stack trace yourself.






def Inchtocm(inches):
 Returns 2.54 * inches
 return (2.54 * float(inches_number1))



As Joel pointed out, you're using a global instead of the parameter that 
was passed.  Call float() on  inches, not on some non-local variable.




inches = None
while True:
 try:
 inches_number1 = input(input(How many inches you want to convert:
))


Calling input(input())  doesn't do any favors.  It echoes the first 
response, and waits for another one.  The user doesn't probably realize 
that he has to type the number 455 twice.



 inches = float(inches_number1)


Since you're presumably getting the exception on this line, you should 
print out the value you're trying to convert.  You can remove the print 
after it works.



 print (You got, Inchtocm(inches), cm.)
 print (You converted, inches, inches to cm.)
 break
 except ValueError:
 print (This is not a number!)

The code is incomplete and i am not getting a proper output:

How many inches you want to convert: 455
455
This is not a number!
How many inches you want to convert:


--
DaveA

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help with inch to cms conversion .

2013-02-11 Thread Danny Yoo
On Mon, Feb 11, 2013 at 9:06 AM, Pravya Reddy pravyare...@gmail.com wrote:
 Can you please help me with the code.

 #!/usr/bin/env python
 
 inchtocm.py

 

 def Inchtocm(inches):
 Returns 2.54 * inches
 return (2.54 * float(inches_number1))


I don't know if your curriculum talks about writing test cases for
functions.  If your instructors do not mention it, ask them, because
it's a crucial concept.  And if they have no clue about it (which is
unfortunately possible), you probably will need to stretch a little to
learn about them yourself.



Python's default testing framework, unittest, unfortunately requires
knowledge on how to use classes, which you haven't probably seen
yet.  And it's a bit heavyweight, to boot.

In lieu of that, you can use something simpler: just run your
Inchtocm() with a few sample inputs first, and assert that they have
the right value, like this:


def Inchtocm(inches):
Returns 2.54 * inches
return (2.54 * float(inches_number1))

assert Inchtocm(0) == 0


Note that we don't just call Inchtocm(), but check to see that it has
the right value.  This is important: otherwise, you are not really
testing the function, but just making it run.  The code above just
has one test: usually, you want to add a few more.  And you want to
write them _before_ you code up the function.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help with running perl script that writes to a text file

2013-02-06 Thread Peter Otten
3n2 Solutions wrote:

 Hello,
 
 I want to automate the following manual process from DOS promp:
 
 c:/scripts/perlperl fix.pl base.gtx base.txt
 
 Here is my python script:
 
 path=c:/scripts/perl/
 subprocess.call(['perl','fix.pl','base.gtx base.txt',path])
 
 I also tried this alternative:
 
 subprocess.Popen(['perl','fix.pl','base.gtx base.txt',path]) #same
 result from this method.
 
 The above script generates the base.txt file but has no content in it.
 
 any ideas as to why the resulting text file is empty? Am I using the
 correct python commands to run the above manual process?

I'm surprised that base.txt is generated at all, I'd expect fix.pl to look 
for a file named base.gtx base.txt and complain when it doesn't find 
that.

I think the following should work:

with open(c:/scripts/perl/base.txt, w) as f:
subprocess.check_call(
[perl, 
 c:/scripts/perl/fix.pl, 
 c:/scripts/perl/base.gtx], 
stdout=f)



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help with running perl script that writes to a text file

2013-02-06 Thread eryksun
On Tue, Feb 5, 2013 at 6:44 PM, 3n2 Solutions 3n2soluti...@gmail.com wrote:

 I want to automate the following manual process from DOS promp:

I agree with Peter's answer. I'd just like to add a generally useless
and pedantic comment about the habit of saying DOS prompt. The cmd
shell is a Win32 console application, unlike DOS command.com. On
64-bit Windows there isn't even a virtual DOS machine (NTVDM) to run
command.com. There, I feel better now. :)
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help with running perl script that writes to a text file

2013-02-06 Thread Alan Gauld

On 06/02/13 10:58, eryksun wrote:


and pedantic comment about the habit of saying DOS prompt. The cmd
shell is a Win32 console application, unlike DOS command.com.


Yes, but the problem is that Windows now has so many command prompts 
(cscript, cmd, power shell etc) that the Windows prompt

would be meaningless and the cmd prompt too awkward to say,
so the DOS prompt is both traditional and sufficiently specific making 
it the most easily understandable of the likely terms.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help with running perl script that writes to a text file

2013-02-06 Thread eryksun
On Wed, Feb 6, 2013 at 12:47 PM, Alan Gauld alan.ga...@btinternet.com wrote:
 so the DOS prompt is both traditional and sufficiently specific making it
 the most easily understandable of the likely terms.

DOS prompt is a common idiom, but it bears mentioning now and then
that the OS is NT [1], not DOS. That's all; I know I'm being pedantic.

Officially the Windows command-line shell is called the command
prompt. I call it the shell [2] or command line. Unless someone says
PowerShell or 4NT, I assume it's cmd.

[1] Windows 8 is NT 6.2.9200
[2] Not the GUI shell, Explorer, which is set here:
HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Shell
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help- Regarding python

2013-02-05 Thread Oscar Benjamin
On 5 February 2013 05:08, eryksun eryk...@gmail.com wrote:
 On Mon, Feb 4, 2013 at 7:21 PM, Oscar Benjamin
 oscar.j.benja...@gmail.com wrote:
 eigenvalues, eigenvectors = np.linalg.eig(C)

 First sort by eigenvalue magnitude:

  idx = np.argsort(eigenvalues)[::-1]
  print idx
 [ 0  1  2  3  8 10 11 12 14 22 20 21 18 19 23 24 17 16 15 13  9  7  5  6  
 4]

  eigenvalues = eigenvalues[idx]
  eigenvectors = eigenvectors[:, idx]

 # 2D PCA - get the two eigenvectors with the largest eigenvalues
 v1, v2 = eigenvectors[:,:2].T

Thanks. I thought that eig already sorted them. The doc claims says
that the values are not necessarily ordered but when I run it they
are in descending order of absolute value.

Also I should have used eigh since the covariance matrix is Hermitian
(eigh seems to give the eigenvalues in ascending order).


Oscar
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help with running perl script that writes to a text file

2013-02-05 Thread Alan Gauld

On 05/02/13 23:44, 3n2 Solutions wrote:


I want to automate the following manual process from DOS promp:

c:/scripts/perlperl fix.pl base.gtx base.txt


Use a DOS batch file, that's what they are there for.

If you are not doing any other processing Python is inefficient and 
overkill for this task. Unless you just want to learn how to use Popen I 
suppose...




path=c:/scripts/perl/
subprocess.call(['perl','fix.pl','base.gtx base.txt',path])


Do you get any error messages on the console?
How are you running the python script?

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help- Regarding python

2013-02-04 Thread Alan Gauld

On 04/02/13 06:24, Gayathri S wrote:

Hi All!
 If i have data set like this means...

3626,5000,2918,5000,2353,2334,2642,1730,1687,1695,1717,1744,593,502,493,504,449,431,444,444,429,10

...

458,5022,3640,3644,5000,2922,5000,2346,2321,2628,1688,1666,1674,1696,744,590,496.

How to do PCA on this data? if it is in array how to do that? and also
how to use princomp() in PCA?


No idea. I don't know what pca or princomp are.
It looks like they might be numpy or pylab functions in which case you 
probably will get better results posting on a forum for those modules.

This list is for learning the core language and standard library.

Having said that it looks like you could use some time learning the 
basics before delving into numpy etc. comments below...



from numpy import mean,cov,double,cumsum,dot,linalg,array,rank
from pylab import plot,subplot,axis,stem,show,figure
A = array([ [2.4,0.7,2.9,2.2,3.0,2.7,1.6,1.1,1.6,0.9],
 [2.5,0.5,2.2,1.9,3.1,2.3,2,1,1.5,1.1] ])
M = (A-mean(A.T,axis=1)).T[latent,coeff] = linalg.eig(cov(M))
score = dot(coeff.T,M)
return coeff,score,latent


You have a return that is not inside a function. That makes no sense
and in fact I get a syntax error so presumably you haven't actually 
tried running this code.



princomp(A):


This calls princomp() but does nothing with the return values


coeff, score, latent = princomp(A.T)


This calls princomp() and stores 3 return values.
Its unusual for a function to have such different semantics.
Which is correct?


figure()
subplot(121)


Again calling functions without storing values. It may be valid
but looks unlikely...


m = mean(A,axis=1)
plot([0, -coeff[0,0]*2]+m[0], [0, -coeff[0,1]*2]+m[1],'--k')
plot([0, coeff[1,0]*2]+m[0], [0, coeff[1,1]*2]+m[1],'--k')
plot(A[0,:],A[1,:],'ob') # the data
axis('equal')
subplot(122)
plot(score[0,:],score[1,:],'*g')
axis('equal')
plt.show()


Here you use plt but plt is not defined anywhere in your program.

I think you need to go back to Python basics and learn
how to write basic code before trying to use the more
exotic modules.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help- Regarding python

2013-02-04 Thread Steven D'Aprano

On 04/02/13 17:24, Gayathri S wrote:

Hi All!
 If i have data set like this means...

3626,5000,2918,5000,2353,2334,2642,[...],496.


No need to dump your entire data set on us. Just a few representative
values will do.



How to do PCA on this data? if it is in array how to do that? and also how
to use princomp() in PCA?


What's PCA? What's princomp?



Shall i use the following code for doing PCA on given input? could you tell
me?


Have you tried it? What happens?

This is a list for people learning Python the programming language. We are not
experts on numpy, which is a specialist package for scientific use. We are not
statisticians either. You can probably assume that most of us know what
standard deviation is. Anything more complicated than that, you should ask
on a specialist numpy mailing list.

Good luck!



--
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help- Regarding python

2013-02-04 Thread Danny Yoo
 How to do PCA on this data? if it is in array how to do that? and also how
 to use princomp() in PCA?


Principal component analysis,

http://en.wikipedia.org/wiki/Principal_component_analysis

may not be built in.  Do you know for sure that it is?  According to
this blog entry, you can do it in numpy by coding the algorithm:


http://glowingpython.blogspot.com/2011/07/principal-component-analysis-with-numpy.html

If you use Google and search for the term Principal component
analysis Python, you should see several implementations of modules
that provide that algorithm.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help- Regarding python

2013-02-04 Thread Oscar Benjamin
On 4 February 2013 06:24, Gayathri S gayathri.s...@gmail.com wrote:
 Hi All!
 If i have data set like this means...

 3626,5000,2918,5000,2353,2334,2642,1730,1687,1695,1717,1744,593,502,493,504,449,431,444,444,429,10
 438,498,3626,3629,5000,2918,5000,2640,2334,2639,1696,1687,1695,1717,1744,592,502,493,504,449,431,444,441,429,10
 439,498,3626,3629,5000,2918,5000,2633,2334,2645,1705,1686,1694,1719,1744,589,502,493,504,446,431,444,444,430,10
 440,5000,3627,3628,5000,2919,3028,2346,2330,2638,1727,1684,1692,1714,1745,588,501,492,504,451,433,446,444,432,10
 444,5021,3631,3634,5000,2919,5000,2626,2327,2638,1698,1680,1688,1709,1740,595,500,491,503,453,436,448,444,436,10
 451,5025,3635,3639,5000,2920,3027,2620,2323,2632,1706,1673,1681,1703,753,595,499,491,502,457,440,453,454,442,20
 458,5022,3640,3644,5000,2922,5000,2346,2321,2628,1688,1666,1674,1696,744,590,496.

PCA only makes sense for multivariate data: your data should be a set
of vectors *all of the same length*. I'll assume that you were just
being lazy when you posted it and that you didn't bother to copy the
first and last lines properly...

[snip]

 Shall i use the following code for doing PCA on given input? could you tell
 me?

This code you posted is all screwed up. It will give you errors if you
try to run it.

Also I don't really know what you mean by doing PCA. The code below
transforms your data into PCA space and plots a 2D scatter plot using
the first two principal components.

#!/usr/bin/env python
import numpy as np
from matplotlib import pyplot as plt

data = np.array([

[438,498,3626,3629,5000,2918,5000,2640,2334,2639,1696,1687,1695,1717,1744,592,502,493,504,449,431,444,441,429,10],

[439,498,3626,3629,5000,2918,5000,2633,2334,2645,1705,1686,1694,1719,1744,589,502,493,504,446,431,444,444,430,10],

[440,5000,3627,3628,5000,2919,3028,2346,2330,2638,1727,1684,1692,1714,1745,588,501,492,504,451,433,446,444,432,10],

[444,5021,3631,3634,5000,2919,5000,2626,2327,2638,1698,1680,1688,1709,1740,595,500,491,503,453,436,448,444,436,10],

[451,5025,3635,3639,5000,2920,3027,2620,2323,2632,1706,1673,1681,1703,753,595,499,491,502,457,440,453,454,442,20],
])

# Compute the eigenvalues and vectors of the covariance matrix
C = np.cov(data.T)
eigenvalues, eigenvectors = np.linalg.eig(C)

# 2D PCA - get the two eigenvectors with the largest eigenvalues
v1, v2 = eigenvectors[:,:2].T
# Project the data onto the two principal components
data_pc1 = [np.dot(v1, d) for d in data]
data_pc2 = [np.dot(v2, d) for d in data]

# Scatter plot in PCA space
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.plot(data_pc1, data_pc2, 'x')
ax.set_xlabel(r'$PC_1$')
ax.set_ylabel(r'$PC_2$')
ax.legend(['data'])
plt.show()


Oscar
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help- Regarding python

2013-02-04 Thread eryksun
On Mon, Feb 4, 2013 at 7:21 PM, Oscar Benjamin
oscar.j.benja...@gmail.com wrote:
 eigenvalues, eigenvectors = np.linalg.eig(C)

First sort by eigenvalue magnitude:

 idx = np.argsort(eigenvalues)[::-1]
 print idx
[ 0  1  2  3  8 10 11 12 14 22 20 21 18 19 23 24 17 16 15 13  9  7  5  6  4]

 eigenvalues = eigenvalues[idx]
 eigenvectors = eigenvectors[:, idx]

 # 2D PCA - get the two eigenvectors with the largest eigenvalues
 v1, v2 = eigenvectors[:,:2].T
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help

2013-02-02 Thread Alan Gauld

On 02/02/13 01:47, Jack Little wrote:


def simpstart():
   global ammo1
   global ammo2
   global ammo3
   global health
   global tech_parts
   global exp
   global radio_parts
   ammo1=10
   ammo2=0
   ammo3=0
   health=100
   tech_parts=0
   exp=0
   radio_parts=0


This function is completely pointless, you might as well
just define the variables at the top level.


print You awake in a haze. A crate,a door and a radio.
g1 = raw_input(Which do you choose  )
if g1 == CRATE or g1 == Crate or g1 == crate:

...

elif g1 ==DOOR or g1 == Door or g1 == door:
   print You are outside
elif g1 == RADIO or g1 == Radio or g1 == radio:

...

g2 = raw_input(So this is NYC.Ten years after.There are a few
streets.Go west or north  )
if g2 == WEST or g2 == West or g2 == west:
   path2_pt1()
elif g2 == NORTH or g2 == North or g2 == north:
   path1pt1()


The block above is at top level so Python will execute it as it reads 
the file. And at this stage pathpt1 does not exist so it fails. You need 
to move this block into a function (maybe it was intended to be part of 
the one above but you messed up the indent?). Alternatively you need to 
move the definition of pathpt1 above this block.



def path1pt1():
 print This is where it all started. Freedom Tower. A biotech firm
called Aesthos Biotechnology. Based here.
 print I worked there.


HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help

2013-02-01 Thread Brandon
You get the error because you call path1pt1() before it is defined.  Define
your path1pt1() method at the top of your code before simpstart().

Brandon

On Fri, Feb 1, 2013 at 5:47 PM, Jack Little jacklittl...@yahoo.com wrote:

 I get this error

 Traceback (most recent call last):
   File C:\Users\Jack\Desktop\python\g.py, line 56, in module
 path1pt1()
 NameError: name 'path1pt1' is not defined

 With this amount of code:


 def simpstart():
   global ammo1
   global ammo2
   global ammo3
   global health
   global tech_parts
   global exp
   global radio_parts
   ammo1=10
   ammo2=0
   ammo3=0
   health=100
   tech_parts=0
   exp=0
   radio_parts=0
 print You awake in a haze. A crate,a door and a radio.
 g1 = raw_input(Which do you choose  )
 if g1 == CRATE or g1 == Crate or g1 == crate:
 print There is a pack of ammo,some food and an odd microchip
 ammo1=ammo1 + 6
 health=health + 10
 tech_parts=tech_parts + 1
 elif g1 ==DOOR or g1 == Door or g1 == door:
   print You are outside
 elif g1 == RADIO or g1 == Radio or g1 == radio:
   print It's only a few parts
   radio_parts=radio_parts+3
 g2 = raw_input(So this is NYC.Ten years after.There are a few streets.Go
 west or north  )
 if g2 == WEST or g2 == West or g2 == west:
   path2_pt1()
 elif g2 == NORTH or g2 == North or g2 == north:
   path1pt1()


 def path1pt1():
 print This is where it all started. Freedom Tower. A biotech firm
 called Aesthos Biotechnology. Based here.
 print I worked there.

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help

2013-02-01 Thread Dave Angel

On 02/01/2013 08:47 PM, Jack Little wrote:

I get this error

Traceback (most recent call last):
   File C:\Users\Jack\Desktop\python\g.py, line 56, in module
 path1pt1()
NameError: name 'path1pt1' is not defined

With this amount of code:


def simpstart():
   global ammo1
   global ammo2
   global ammo3
   global health
   global tech_parts
   global exp
   global radio_parts
   ammo1=10
   ammo2=0
   ammo3=0
   health=100
   tech_parts=0
   exp=0
   radio_parts=0


You've stopped defining that function, and now are doing top-level code

This following stuff belongs in a function, probably called main()


print You awake in a haze. A crate,a door and a radio.
g1 = raw_input(Which do you choose  )
if g1 == CRATE or g1 == Crate or g1 == crate:
 print There is a pack of ammo,some food and an odd microchip
 ammo1=ammo1 + 6
 health=health + 10
 tech_parts=tech_parts + 1
elif g1 ==DOOR or g1 == Door or g1 == door:
   print You are outside
elif g1 == RADIO or g1 == Radio or g1 == radio:
   print It's only a few parts
   radio_parts=radio_parts+3
g2 = raw_input(So this is NYC.Ten years after.There are a few streets.Go west or 
north  )
if g2 == WEST or g2 == West or g2 == west:
   path2_pt1()
elif g2 == NORTH or g2 == North or g2 == north:
   path1pt1()


Now, in top-level code, you're trying to call a function that hasn't 
been defined yet.  If you want to have complete freedom of order when 
you define your functions, don't put any top-level code except a tiny 
block at the end of the script.  No function may be called before it has 
been defined.  But inside a function, the call won't be made till the 
function is called.  So if the only calls happen at the end of the 
script, there'll never be such a problem.






def path1pt1():
 print This is where it all started. Freedom Tower. A biotech firm called 
Aesthos Biotechnology. Based here.
 print I worked there.



This should be the only non-trivial top-level code, and it should be at 
the end of the script.


if __name__ == __main__:
simpstart()
main()


--
DaveA
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP-Regarding python

2013-01-30 Thread bob gailer

On 1/30/2013 1:51 AM, Gayathri S wrote:

I am sorry that you chose to ignore my request to start a new email with 
a relevant subject.


Please next time do so.

The easier you make it for us to help you the more likely we will want 
to help.


--
Bob Gailer
919-636-4239
Chapel Hill NC

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help!

2013-01-29 Thread Kwpolska
On Mon, Jan 28, 2013 at 10:22 PM, Ghadir Ghasemi
ghasemm...@leedslearning.net wrote:
 Hi guys I wanted to make a program called Binary/decimal converter.

That’s easy, int('11', 2) and bin(3) should be enough.

 But I want to do it the hard way e.g. not using built in python functions. 
 Can you give me an idea about how I can do that?

Are you crazy or is it an assignment?  Write code according to this:
http://en.wikipedia.org/wiki/Binary_number#Conversion_to_and_from_other_numeral_systems
(or other methods you can find on the Internet or in math textbooks).
Alternatively, you can find out how it is done in other programming
languages or even Python itself.  And use that.

PS. actually, it is impossible to do it in plain Python without using
built-in functions.  Because multiplication, division and
exponentiation and whatnot are built-ins.

OP, please tell your mail provider that it shouldn’t filter
swearwords, and even if it does, that it shouldn’t inform me of that.

-- 
Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16
stop html mail| always bottom-post
http://asciiribbon.org| http://caliburn.nl/topposting.html
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP- Regarding working with python

2013-01-29 Thread Gayathri S
Hi all...!
I don't know how to import our own data sets in python. its
always importing the in built data sets. could you just tell me how to do
that...!


Thanks...!

On Mon, Jan 28, 2013 at 1:50 PM, Steven D'Aprano st...@pearwood.infowrote:

 On 28/01/13 18:26, Gayathri S wrote:

 Hi all..!
 wanna know how to compile python script in python command
 line,
 and is there any need for setting path for python like JAVA? whats the
 difference between .py file and .pyc file?



 Python is a byte-code compiled language, like Java many years ago.
 Normally to compile a python module, you just import it from within Python.

 That is not very convenient for scripts, so from the shell (bash,
 command.com, cmd.exe, or similar) you can run

 python -m compileall NAME NAME ...

 to compile scripts.


 You do not necessarily need to set the PYTHONPATH, but you can if you need
 to.

 .py files are source code. .pyc are compiled byte code. .pyo are compiled
 byte code with optimization turned on. Don't get too excited, the standard
 Python optimization doesn't do very much.



 --
 Steven

 __**_
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/**mailman/listinfo/tutorhttp://mail.python.org/mailman/listinfo/tutor




-- 




Keep Smiling.
Regards
Gayu
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP-Regarding python

2013-01-29 Thread Dave Angel

On 01/30/2013 01:51 AM, Gayathri S wrote:

Hi All!
  I don't know how to read text file in python. If the data
values are stored in a text file format, for example(1,30,60,90,120...200)
means what i would do for reading it in python. could you just explain it.




infile = open(filename, rt)will open a text file

line = infile.readline()will read one line from it, as a str

After that, you can parse it anyway you like.




--
DaveA
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP-Regarding python

2013-01-29 Thread spawgi
A safer approach would be -
with open(filepath, mode as filehandle:
indent//operation with the file.

This way, you do not have to remember to close the file explicitly.


On Wed, Jan 30, 2013 at 12:27 PM, Dave Angel da...@davea.name wrote:

 On 01/30/2013 01:51 AM, Gayathri S wrote:

 Hi All!
   I don't know how to read text file in python. If the
 data
 values are stored in a text file format, for example(1,30,60,90,120...200)
 means what i would do for reading it in python. could you just explain it.



 infile = open(filename, rt)will open a text file

 line = infile.readline()will read one line from it, as a str

 After that, you can parse it anyway you like.




 --
 DaveA
 __**_
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/**mailman/listinfo/tutorhttp://mail.python.org/mailman/listinfo/tutor




-- 
http://spawgi.wordpress.com
We can do it and do it better.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP-Regarding python

2013-01-29 Thread spawgi
missed a parenthesis, it should look like -
with open(filepath, mode) as filehandle:
indent//operation with the file.


On Wed, Jan 30, 2013 at 12:31 PM, spa...@gmail.com wrote:

 A safer approach would be -
 with open(filepath, mode as filehandle:
 indent//operation with the file.

 This way, you do not have to remember to close the file explicitly.


 On Wed, Jan 30, 2013 at 12:27 PM, Dave Angel da...@davea.name wrote:

 On 01/30/2013 01:51 AM, Gayathri S wrote:

 Hi All!
   I don't know how to read text file in python. If the
 data
 values are stored in a text file format, for
 example(1,30,60,90,120...200)
 means what i would do for reading it in python. could you just explain
 it.



 infile = open(filename, rt)will open a text file

 line = infile.readline()will read one line from it, as a str

 After that, you can parse it anyway you like.




 --
 DaveA
 __**_
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/**mailman/listinfo/tutorhttp://mail.python.org/mailman/listinfo/tutor




 --
 http://spawgi.wordpress.com
 We can do it and do it better.




-- 
http://spawgi.wordpress.com
We can do it and do it better.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP- Regarding working with python

2013-01-28 Thread Steven D'Aprano

On 28/01/13 18:26, Gayathri S wrote:

Hi all..!
wanna know how to compile python script in python command line,
and is there any need for setting path for python like JAVA? whats the
difference between .py file and .pyc file?



Python is a byte-code compiled language, like Java many years ago. Normally to 
compile a python module, you just import it from within Python.

That is not very convenient for scripts, so from the shell (bash, command.com, 
cmd.exe, or similar) you can run

python -m compileall NAME NAME ...

to compile scripts.


You do not necessarily need to set the PYTHONPATH, but you can if you need to.

.py files are source code. .pyc are compiled byte code. .pyo are compiled byte 
code with optimization turned on. Don't get too excited, the standard Python 
optimization doesn't do very much.



--
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help!

2013-01-28 Thread Mark K. Zanfardino

Ghadir,

I did a quick google search for how to convert digital to binary. The 
first link was to 
http://www.ehow.com/how_5164721_convert-digital-binary.html which gives 
a pretty clear example of the process for converting digital to binary.  
Of course, you will need to translate this psuedo-code into an algorithm 
using Python.


Cheers!
Mark K. Zanfardino

On 01/28/2013 01:22 PM, Ghadir Ghasemi wrote:

Hi guys I wanted to make a program called Binary/decimal converter. But I want 
to do it the hard way e.g. not using built in python functions. Can you give me 
an idea about how I can do that?
Thank you.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help!

2013-01-28 Thread Danny Yoo
 Hi guys I wanted to make a program called Binary/decimal converter. But I 
 want to do it the hard way e.g. not using built in python functions. Can you 
 give me an idea about how I can do that?


Do you have an idea of what kind of things would be useful test cases
for this converter?  Thinking about this may help solidify what it is
you're trying to do.  By it, we want to help you express concretely
what you mean when you say binary/decimal converter.

---

For example, if I wanted to write a program to convert snow to
water, I might start like this:

I want to write a program to take words like snow and rewrite them
to water.  But anything else should stay the same.  Let me give a
name to this.  Call it melt.  Here are some examples I'd like to
make work (or not work).

melt(The snow is cold!)  == The water is cold!
melt(The snowflakes are falling) ==  The snowflakes are falling
melt(Snow and ice) ==  Water and ice

That is, I want to make sure the translation is case sensitive, but
only applies when the whole word snow shows up.


... etc.  A potential approach might use regular expression
replacement, with a little bit of care about using a function for the
replacement argument so we can handle the weird uppercasing
requirement...

---


If you plan like this, and include concrete test cases, then you'll
have a better shot at solving the problem.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help!

2013-01-28 Thread Joel Goldstick
On Mon, Jan 28, 2013 at 4:51 PM, Danny Yoo d...@hashcollision.org wrote:

  Hi guys I wanted to make a program called Binary/decimal converter. But
 I want to do it the hard way e.g. not using built in python functions. Can
 you give me an idea about how I can do that?


 See if you can write the steps to do this by hand.  You take binary
number -- say 10110 and convert it to decimal.  If you can do that with pad
and pencil, you are off to a good start.  If you can't, then you have to
learn that first.  Its not magic.  Learning about bit shifting will help



 Do you have an idea of what kind of things would be useful test cases
 for this converter?  Thinking about this may help solidify what it is
 you're trying to do.  By it, we want to help you express concretely
 what you mean when you say binary/decimal converter.

 ---

 For example, if I wanted to write a program to convert snow to
 water, I might start like this:

 I want to write a program to take words like snow and rewrite them
 to water.  But anything else should stay the same.  Let me give a
 name to this.  Call it melt.  Here are some examples I'd like to
 make work (or not work).

 melt(The snow is cold!)  == The water is cold!
 melt(The snowflakes are falling) ==  The snowflakes are falling
 melt(Snow and ice) ==  Water and ice

 That is, I want to make sure the translation is case sensitive, but
 only applies when the whole word snow shows up.


 ... etc.  A potential approach might use regular expression
 replacement, with a little bit of care about using a function for the
 replacement argument so we can handle the weird uppercasing
 requirement...

 ---


 If you plan like this, and include concrete test cases, then you'll
 have a better shot at solving the problem.
 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor




-- 
Joel Goldstick
http://joelgoldstick.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP- Regarding working with python

2013-01-27 Thread Gayathri S
Hi all..!
   wanna know how to compile python script in python command line,
and is there any need for setting path for python like JAVA? whats the
difference between .py file and .pyc file?
Thanks...!

On Sat, Jan 19, 2013 at 8:54 AM, bob gailer bgai...@gmail.com wrote:

 On 1/18/2013 8:03 AM, eryksun wrote:

 Yes, it's a mistake in the PCA example from the docs:

 http://mlpy.sourceforge.net/**docs/3.5/dim_red.html#**
 principal-component-analysis-**pcahttp://mlpy.sourceforge.net/docs/3.5/dim_red.html#principal-component-analysis-pca

 There seems to be no way to report a bug in that documentation! Or am I
 missing something?

 --
 Bob Gailer
 919-636-4239
 Chapel Hill NC


 __**_
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/**mailman/listinfo/tutorhttp://mail.python.org/mailman/listinfo/tutor




-- 




Keep Smiling.
Regards
Gayu
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help!

2013-01-26 Thread Jos Kerc
You are missing a multiplication sign.

Near the end of your formula.


On Fri, Jan 18, 2013 at 1:56 PM, Carpenter, Steven 
steven.carpen...@oakland.k12.mi.us wrote:

 To Whom it May Concern,

 I’m trying to get this code working. *Here’s my question:*

 Consider a triangle with sides of length 3, 7, and 9. The law of cosines
 states that given three sides of a triangle (a, b, and c) and angle C
 between sides a and b: Write Python code to calculate the three angles in
 the triangle.

 *Here’s my code: *

 # Calculate the angles in a triangle

 # Imports the Math data

 import math

 # Sets up the different angles with corresponding letters

 # The first angle is a

 a = 3

 # The second angle is b

 b = 7

 # The third angle is c

 c = 9

 # Calculates angle C

 print(math.acos(((a**2)+(b**2)-(c**2))/(2(a*b

 *Here’s my output:*

 Traceback (most recent call last):

   File E:\Programming\Problem4.py, line 12, in module

 print(math.acos(((a**2)+(b**2)-(c**2))/(2(a*b

 TypeError: 'int' object is not callable

 ** **

 *Steven Carpenter*

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help!

2013-01-26 Thread Russel Winder
Following up on Jos Kerc's answer:
 
On Fri, 2013-01-18 at 07:56 -0500, Carpenter, Steven wrote:
[…]
 print(math.acos(((a**2)+(b**2)-(c**2))/(2(a*b

2(a*b) → 2 * (a * b)

 TypeError: 'int' object is not callable

Juxtaposition does not imply multiplication in Python as it does in
mathematics.
-- 
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


signature.asc
Description: This is a digitally signed message part
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP- Regarding working with python

2013-01-18 Thread Marc Tompkins
On Thu, Jan 17, 2013 at 10:11 PM, Gayathri S gayathri.s...@gmail.comwrote:

  import numpy as np
  import matplotlib.pyplot as plt
  import mlpy
  np.random.seed(0)
  mean,cov,n=[0,0],[[1,1],[1,1.5]],100
  x=np.random.multivariate_normal(mean,cov,n)
  pca.learn(x)
 Traceback (most recent call last):
   File interactive input, line 1, in module
 NameError: name 'pca' is not defined
 
 would you please help me in finding the error...? what was my fault? how
 could i use PCA in python..?

 The error means exactly what it says: you've referred to pca, but you
haven't told Python what pca is.

I don't know the actual name of the PCA module you're using, but you need
to import it the same way you've imported the other packages:
-  if it's called simply pca, then just write import pca
-  if it has some other, slightly longer name, and you want to shorten it
(as you did with numpy, shortening it to np), then: import longPCAname
as pca
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP- Regarding working with python

2013-01-18 Thread Lie Ryan

On 18/01/13 17:11, Gayathri S wrote:

hi...
   I am using principal component analysis for dimensionality
reduction in python. am having this following error...
  import numpy as np
  import matplotlib.pyplot as plt
  import mlpy
  np.random.seed(0)
  mean,cov,n=[0,0],[[1,1],[1,1.5]],100
  x=np.random.multivariate_normal(mean,cov,n)
  pca.learn(x)
Traceback (most recent call last):
   File interactive input, line 1, in module
NameError: name 'pca' is not defined
 
would you please help me in finding the error...? what was my fault? how
could i use PCA in python..?


You might want to start with a more basic tutorials for working with 
python, for example the official tutorial at 
http://docs.python.org/2/tutorial/ You should go through at least the 
first 5-6 chapters, which should take no more than several hours to skim 
through if you already have experience in any other languages.


As in your particular problem, the basic issue is that you have not 
defined 'pca' to refer to any object. You need to create an object named 
pca, which in this particular case the object is probably an instance of 
mlpy.PCA, which can be constructed like this:


pca = mlpy.PCA()



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP- Regarding working with python

2013-01-18 Thread eryksun
On Fri, Jan 18, 2013 at 3:25 AM, Lie Ryan lie.1...@gmail.com wrote:
 On 18/01/13 17:11, Gayathri S wrote:

   import numpy as np
   import matplotlib.pyplot as plt
   import mlpy
   np.random.seed(0)
   mean,cov,n=[0,0],[[1,1],[1,1.5]],100
   x=np.random.multivariate_normal(mean,cov,n)
   pca.learn(x)
 Traceback (most recent call last):
File interactive input, line 1, in module
 NameError: name 'pca' is not defined

 As in your particular problem, the basic issue is that you have not defined
 'pca' to refer to any object. You need to create an object named pca, which
 in this particular case the object is probably an instance of mlpy.PCA,
 which can be constructed like this:

 pca = mlpy.PCA()

Yes, it's a mistake in the PCA example from the docs:

http://mlpy.sourceforge.net/docs/3.5/dim_red.html#principal-component-analysis-pca
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP- Regarding working with python

2013-01-18 Thread bob gailer

On 1/18/2013 8:03 AM, eryksun wrote:

Yes, it's a mistake in the PCA example from the docs:

http://mlpy.sourceforge.net/docs/3.5/dim_red.html#principal-component-analysis-pca
There seems to be no way to report a bug in that documentation! Or am I 
missing something?


--
Bob Gailer
919-636-4239
Chapel Hill NC

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP- Regarding working with python

2013-01-17 Thread Gayathri S
hi...
  I am using principal component analysis for dimensionality
reduction in python. am having this following error...
 import numpy as np
 import matplotlib.pyplot as plt
 import mlpy
 np.random.seed(0)
 mean,cov,n=[0,0],[[1,1],[1,1.5]],100
 x=np.random.multivariate_normal(mean,cov,n)
 pca.learn(x)
Traceback (most recent call last):
  File interactive input, line 1, in module
NameError: name 'pca' is not defined

would you please help me in finding the error...? what was my fault? how
could i use PCA in python..?

  Thanks.!

On Wed, Jan 9, 2013 at 12:58 PM, Gayathri S gayathri.s...@gmail.com wrote:

 Hi..
 I would like to use Principal component analysis independent
 component analysis in python. Wanna know whether it will support this
 efficiently or not?


 On Wed, Jan 2, 2013 at 4:59 PM, Alan Gauld alan.ga...@btinternet.comwrote:

 On 02/01/13 07:20, Gayathri S wrote:

 Hi..
   I am using python 2.7 and scikit-learn for machine learning.
 And OS is Windows 7. Wanna know how to import our own data sets  in
 scikit-learn?


 Further to my last mail there is a gmane group

 gmane.comp.python.scikit-learn

 I'd try looking there, or wherever it is sourced originally.



 --
 Alan G
 Author of the Learn to Program web site
 http://www.alan-g.me.uk/

 __**_
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/**mailman/listinfo/tutorhttp://mail.python.org/mailman/listinfo/tutor




 --




 Keep Smiling.
 Regards
 Gayu




-- 




Keep Smiling.
Regards
Gayu
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help for a beginner

2013-01-11 Thread vishwajeet singh
On Sat, Jan 12, 2013 at 12:28 AM, MDB bashya...@gmail.com wrote:

 Hi,
 I am a beginner to progrmming and want to learn basic python. I am a
 scientist (with less math background) with absolutely no programming
 experience. Are there any web based tutorials/videos/books to learn python.


The best book for beginners in my experience is Python for Absolute
Beginners, I liked it's approach in making learning a bit fun.
A good online resource is http://www.alan-g.me.uk/


 Any help is deeply appreciated,
 thanks
 Murail
 --
 Murali Dharan Bashyam, PhD, MNAScI
 Staff Scientist and Chief,
 Laboratory of Molecular Oncology,
 Centre for DNA Fingerprinting and Diagnostics (CDFD),
 Tuljaguda complex, Nampally,
 Hyderabad 51, INDIA
 Ph: 91-40-24749383
 Fax: 91-40-24749448

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor




-- 
Vishwajeet Singh
+91-9657702154 | dextrou...@gmail.com | http://bootstraptoday.com
Twitter: http://twitter.com/vishwajeets | LinkedIn:
http://www.linkedin.com/in/singhvishwajeet
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help for a beginner

2013-01-11 Thread Graham Dubow
Murail,

Check out Udacity.com and the CS101 course. Great video lectures reinforced
by homework and problems (with answers) that you can do yourself. Also
has a very good forum and active user base to ask questions.

It is a good starting point for a beginner and teaches the basics behind
how to build a simple web crawler using Python.




Cheers,


Graham

On Fri, Jan 11, 2013 at 1:58 PM, MDB bashya...@gmail.com wrote:

 Hi,
 I am a beginner to progrmming and want to learn basic python. I am a
 scientist (with less math background) with absolutely no programming
 experience. Are there any web based tutorials/videos/books to learn python.

 Any help is deeply appreciated,
 thanks
 Murail
 --
 Murali Dharan Bashyam, PhD, MNAScI
 Staff Scientist and Chief,
 Laboratory of Molecular Oncology,
 Centre for DNA Fingerprinting and Diagnostics (CDFD),
 Tuljaguda complex, Nampally,
 Hyderabad 51, INDIA
 Ph: 91-40-24749383
 Fax: 91-40-24749448

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP- Regarding working with python

2013-01-08 Thread Gayathri S
Hi..
I would like to use Principal component analysis independent
component analysis in python. Wanna know whether it will support this
efficiently or not?

On Wed, Jan 2, 2013 at 4:59 PM, Alan Gauld alan.ga...@btinternet.comwrote:

 On 02/01/13 07:20, Gayathri S wrote:

 Hi..
   I am using python 2.7 and scikit-learn for machine learning.
 And OS is Windows 7. Wanna know how to import our own data sets  in
 scikit-learn?


 Further to my last mail there is a gmane group

 gmane.comp.python.scikit-learn

 I'd try looking there, or wherever it is sourced originally.



 --
 Alan G
 Author of the Learn to Program web site
 http://www.alan-g.me.uk/

 __**_
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/**mailman/listinfo/tutorhttp://mail.python.org/mailman/listinfo/tutor




-- 




Keep Smiling.
Regards
Gayu
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help about to how many times the function called

2013-01-04 Thread Steven D'Aprano

On 04/01/13 20:17, lei yang wrote:

Hi experts

I have a function will print PASS status



def print_pass(t_elapsed):
 
 Print PASS to stdout with PASS (green) color.
 
 print_stdout(bcolors.PASS + PASS + bcolors.ENDC +  (%.2f s) % 
t_elapsed)

I want to calculate the pass number, so I want to get  how many times
this function called

any help?



how_many_times = 0

def print_pass(t_elapsed):

Print PASS to stdout with PASS (green) color.

global how_many_times
how_many_times += 1
print_stdout(bcolors.PASS + PASS + bcolors.ENDC +  (%.2f s) % t_elapsed)




--
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help about to how many times the function called

2013-01-04 Thread bob gailer

On 1/4/2013 4:25 AM, Steven D'Aprano wrote:

On 04/01/13 20:17, lei yang wrote:

Hi experts

I have a function will print PASS status



def print_pass(t_elapsed):
 
 Print PASS to stdout with PASS (green) color.
 
 print_stdout(bcolors.PASS + PASS + bcolors.ENDC +  (%.2f s) 
% t_elapsed)


I want to calculate the pass number, so I want to get  how many times
this function called 


It is unclear to me what you want to do with the pass number or what 
PASS means or where bcolors comes from.


If you don't need to refer to the pass number outside the function 
another way (better IMHO):


def print_pass(t_elapsed, how_many_times=0):

Print PASS to stdout with PASS (green) color.

how_many_times += 1
print_stdout(bcolors.PASS + PASS + bcolors.ENDC +  (%.2f s) % 
t_elapsed)


I for one would appreciate a more complete explanation.

--
Bob Gailer
919-636-4239
Chapel Hill NC

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP- Regarding working with python

2013-01-02 Thread Alan Gauld

On 02/01/13 07:20, Gayathri S wrote:

Hi..
  I am using python 2.7 and scikit-learn for machine learning.
And OS is Windows 7. Wanna know how to import our own data sets  in
scikit-learn?



Hi,

This list is for learning Python and its standard library.

Your question looks to be specific to scikit-learn so will likely get 
more success asking on a scikit-learn forum or by contacting the author 
of scikit-learn.


If you are very lucky some of the folks on this list might just happen 
to have scikit-learn experience, but it isn't guaranteed.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP- Regarding working with python

2013-01-02 Thread Alan Gauld

On 02/01/13 07:20, Gayathri S wrote:

Hi..
  I am using python 2.7 and scikit-learn for machine learning.
And OS is Windows 7. Wanna know how to import our own data sets  in
scikit-learn?


Further to my last mail there is a gmane group

gmane.comp.python.scikit-learn

I'd try looking there, or wherever it is sourced originally.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help

2012-12-30 Thread Mike G
Hi Randy

 I am an older newbie teaching myself Python programming.


Me too :)

 My problem is I hear no system bell; the enter doesn't respond by quitting 
 the program;
 The problem with the program code the enter key hasn't worked in earlier 
 programs.

 I appreciate any advice I may recieve with this coding glitch.


I copied the code into a blank .py file and ran it from cmd in Windows
XP x86 using Python 273, it worked fine - including the beep. As well,
hitting Enter exited the program.

It sounds like (no pun intended) it may be how you're running the
program. I would use a py file and run it using cmd - holler if you
need help, you may if the path to Python isn't good to go.

Mike
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help

2012-12-29 Thread Kwpolska
On Fri, Dec 28, 2012 at 1:30 PM, Evans Anyokwu onyx...@gmail.com wrote:
 I just tried your code and it worked for me. Like Alan and Steven have
 pointed out already, sounding the system bell depends on how you are running
 the code and your platform.

 On my computer I have Putty installed which I use to connect remotely to my
 server - so running that script remotely will not produce any sound.

WRONG!  print '\a' sends ASCII 0x07 to the terminal, which then is
handled by the terminal the way you (or the developer) told it to
handle it.  Now, you have set PuTTY to ignore bells (or, more likely,
did not bother to change the setting and got the default).  This is
why you did not hear it.

 print 'sp\am'
sp[beep!]m [= 73 70 07 6D]


 However, it worked when saved and run locally on my Windows computer.

Because cmd (or whatever else you used) is set to make sound with the bell.

-- 
Kwpolska http://kwpolska.tk
stop html mail  | always bottom-post
www.asciiribbon.org | www.netmeister.org/news/learn2quote.html
GPG KEY: 5EAAEA16
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help

2012-12-28 Thread Evans Anyokwu
On Thu, Dec 27, 2012 at 12:07 PM, Randy WhiteWolf
randywhitew...@ymail.comwrote:

 I am an older newbie teaching myself Python programming. I copied the code
 # Emonstrates escape sequences. This exercise is on page 22 of the Phthon
 Programming for the Absolute Beginner by Michael Dawson. I have copied the
 code verbatim below.



 # Sound the system bell
 print \a

 print \t\t\tFancy Credits

 print \t\t\t \\ \\ \\ \\ \\ \\ \\
 print \t\t\t\tby
 print \t\t\tMichael Dawson
 print \t\t\t \\ \\ \\ \\ \\ \\ \\
 print \nSpecial thanks goes out to:
 print My hair stylist. Henry \'The Great\', who never says \can\'t\.

 raw_input (\n\nPress the enter key to exit.)


 My problem is I hear no system bell; the enter doesn't respond by quitting
 the program; The problem with the program code the enter key hasn't worked
 in earlier programs.

 I appreciate any advice I may recieve with this coding glitch.

 Sincerely,
 Randy

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor


I just tried your code and it worked for me. Like Alan and Steven have
pointed out already, sounding the system bell depends on how you are
running the code and your platform.

On my computer I have Putty installed which I use to connect remotely to my
server - so running that script remotely will not produce any sound.
However, it worked when saved and run locally on my Windows computer.

If on windows try this -
 print '\a'


If it still does not work make sure that your sound card is functioning and
the volume it not  muted.

Good luck.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help

2012-12-27 Thread Steven D'Aprano

On 27/12/12 23:07, Randy WhiteWolf wrote:


# Sound the system bell
print \a


That comment is misleading. \a does not necessarily sound the system
bell. Whether it does or not depends on the terminal you are using.
For example, under Linux I am using the Konsole terminal, and I
have four settings for the terminal bell:

* Off
* Flash the screen
* System notification
* Make a sound

except that the make a sound setting doesn't appear to work. Other
terminals may offer other choices, or no choice at all.

So chances are high that printing \a will not ring the system bell.


[...]

raw_input (\n\nPress the enter key to exit.)


My problem is I hear no system bell; the enter doesn't respond by
quitting the program; The problem with the program code the enter
key hasn't worked in earlier programs.



The enter key thing will depend on how you are running the code.

If you are running the code inside an interactive environment, such
as IDLE or the default Python interactive interpreter, then the above
line of code does not exit. Just because it says Press enter to exit
doesn't make it exit! If it said Press enter to become King of
England, you wouldn't expect that to happen would you? *wink*

However, when you run a script non-interactively, the script will exit
when it gets to end of the file. So if you add this line just before
the end:

raw_input(blah blah blah any message at all)

when Python reaches this line, it will pause until you hit the Enter
key, then it will reach the end of the script, then it will exit.



--
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help

2012-12-27 Thread Alan Gauld

On 27/12/12 12:07, Randy WhiteWolf wrote:


Phthon Programming for the Absolute Beginner by Michael Dawson. I have
copied the code verbatim below.
# Sound the system bell
print \a

 ...

raw_input (\n\nPress the enter key to exit.)
My problem is I hear no system bell; the enter doesn't respond by
quitting the program;


How are you running the code?
I suspect you are using IDLE or Pythonwin or some other IDE?
These generally don't obey the standard escape character
conventions. And in fact not all terminals do either!

If you put the code in a text file called screen.py (or
whatever you prefer) and run it from the command line with

C:\Windows python screens.py

You might see something more like the expected result.
But a lot depends on your OS and terminal software.
My Linux terminal doesn't ring a bell (or flash) for example.
Lesson: don't rely on terminal escape characters unless you know exactly 
what terminal your users will be using.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help please!

2012-12-14 Thread Kwpolska
On Sun, Dec 2, 2012 at 2:37 AM, Jack Little jacklittl...@yahoo.com wrote:
 Hi Tutor,
 I'm getting this error

 Traceback (most recent call last): File C:\Users\Jack\Desktop\python\g.py,
 line 45, in module path_1pt1() NameError: name 'path_1pt1' is not defined

 With the attached file

 Please get back to me
 Thank you

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor


You need to define path_1pt1 *before* simpstart.  Also, about not “free source”:
(a) did you mean: open source?
(b) why did you publish it here?

-- 
Kwpolska http://kwpolska.tk
stop html mail  | always bottom-post
www.asciiribbon.org | www.netmeister.org/news/learn2quote.html
GPG KEY: 5EAAEA16
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help please!

2012-12-14 Thread Steven D'Aprano

On 02/12/12 12:37, Jack Little wrote:

Hi Tutor,
I'm getting this error

Traceback (most recent call last): File C:\Users\Jack\Desktop\python\g.py,
line 45, inmodule  path_1pt1()
NameError: name 'path_1pt1' is not defined



Names need to be defined before they are used. Code needs to be indented to
be inside a function, if it is not indented then it is considered to be part
of the top level code that runs immediately.

So you begin a new function, simpstart:



def simpstart():
   global ammo
   global health
   global tech_parts
   global radio_parts


By the way, you can consolidate those four lines to one:

global ammo, health, tech_parts, radio_parts


But here you lose the indentation, so Python considers the following to
be top level code and executes it immediately:


print You awake in a haze. A crate,a door and a radio.
g1 = raw_input(Which do you choose  )


Questions in English should end with a question mark, or people will
consider you ignorant and illiterate. Unless you are a famous poet
or artist, in which case they will fawn over how transgressive you are.



if g1 == CRATE or g1 == Crate or g1 == crate:


What if they type cRAtE or crATE?

Much simpler to do this:

if g1.lower() == create:

By the way, you will find programming much, much simpler if you always
use meaningful variable names. g1? What does that mean? A better name
would be something like user_response, or even just response.

So, skipping ahead, we come to this bit:


elif g2 == NORTH or g2 == North or g2 == north:
 path_1pt1()


Again, this is better written as if g2.lower() == 'north':.

At this point, Python then tries to call the path_1pt function, but it
hasn't been defined yet. So it gives you a NameError.

How do you fix this? Simple: this entire block of code needs to be
indented level with the global declarations at the start of simstart.

(Fixing this error may very well reveal further errors. Good luck!)

Another comment:



#A Towel Production
# APOC
#---
global ammo1
global ammo2
global ammo3
global health
global tech_parts
global exp
global radio_parts


These seven global lines don't do anything. They are literally pointless. One
of the mysteries to me is why Python allows global declarations outside of
functions, but these lines literally do nothing at all except fool the reader
(you!) into thinking that they do something. Get rid of them.



ammo1=10
ammo2=0
ammo3=0


I note that you have three variables, ammo1 through ammo3, but in the
simpstart function, you declare a global ammo.




--
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with web.py error

2012-12-05 Thread eryksun
On Wed, Dec 5, 2012 at 2:13 AM, Erik Martinson eman_...@yahoo.com wrote:

 File /usr/lib/python2.7/sqlite3/dbapi2.py, line 63, in convert_date
  return datetime.date(*map(int, val.split(-)))

 ValueError: invalid literal for int() with base 10: '21 01:47:43'
 127.0.0.1:59850 - - [04/Dec/2012 22:47:35] HTTP/1.1 GET / - 500 Internal
 Server Error

 I understand the error, there is no way '21 01:47:43' can become an int.
 What I can not figure out is the correlation between the last two lines in
 the traceback. What is actually calling the last command 'datetime.date'?

See the web.py SqliteDB class:

https://github.com/webpy/webpy/blob/master/web/db.py#L1010

Notice it sets 'detect_types'. More here:

http://docs.python.org/2/library/sqlite3.html#module-functions-and-constants
http://docs.python.org/2/library/sqlite3.html#default-adapters-and-converters

The issue then is the created field in your todo table is type
date, but contains a timestamp.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with writing a program

2012-12-03 Thread Steven D'Aprano

On 03/12/12 14:59, rajesh mullings wrote:

Hello, I am trying to write a program which takes two lines of input, one
called a, and one called b, which are both strings, then outputs the
number of times a is a substring of b. If you could give me an
algorithm/pseudo code of what I should do to create this program, I would
greatly appreciate that. Thank you for using your time to consider my
request.


Are you talking about something like this?

a = ing
b = \
Our ingenious plan worked, and the Laughing Prince, last seen capering
madly while his Motley Monks sat gibbering, was soon vanquished, though
not without some achingly painful experiences.


count(b, a)

= should return 5


If that is what you want, try reading the Fine Manual about string methods,
and you can count on finding something to help solve this problem.

https://duckduckgo.com/?q=python%20string%20methods



--
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with writing a program

2012-12-02 Thread Mark Lawrence

On 03/12/2012 03:59, rajesh mullings wrote:

Hello, I am trying to write a program which takes two lines of input, one
called a, and one called b, which are both strings, then outputs the
number of times a is a substring of b. If you could give me an
algorithm/pseudo code of what I should do to create this program, I would
greatly appreciate that. Thank you for using your time to consider my
request.



Start here http://docs.python.org/2/library/string.html

--
Cheers.

Mark Lawrence.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with writing a program

2012-12-02 Thread fantasticrm
The Python version, is Python 3.

On Sun, Dec 2, 2012 at 10:59 PM, rajesh mullings fantasti...@gmail.comwrote:

 Hello, I am trying to write a program which takes two lines of input, one
 called a, and one called b, which are both strings, then outputs the
 number of times a is a substring of b. If you could give me an
 algorithm/pseudo code of what I should do to create this program, I would
 greatly appreciate that. Thank you for using your time to consider my
 request.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with writing a program

2012-12-02 Thread Luke Paireepinart
There is an equivalent page in the documentation for Python 3 as well,
regarding strings.

This sounds a lot like a homework problem so you are unlikely to get a lot
of help.  You certainly won't get exact code.

What have you tried so far?  Where are you getting stuck?  We're not here
to write code for you, this list is meant to help you learn something
yourself.  If you just want someone to write code for you there are plenty
of sites that will do that.  But if you want to figure it out I'd be happy
to give you some hints if I can see that you're making some effort.  One
effort you could make would be to find the relevant Python 3 document
discussing strings and check if it has some references to finding
substrings.

Let me know what you try and I'll help you if you get stuck.

Thanks,
-Luke


On Sun, Dec 2, 2012 at 11:31 PM, fantasticrm fantasti...@gmail.com wrote:

 The Python version, is Python 3.


 On Sun, Dec 2, 2012 at 10:59 PM, rajesh mullings fantasti...@gmail.comwrote:

 Hello, I am trying to write a program which takes two lines of input, one
 called a, and one called b, which are both strings, then outputs the
 number of times a is a substring of b. If you could give me an
 algorithm/pseudo code of what I should do to create this program, I would
 greatly appreciate that. Thank you for using your time to consider my
 request.



 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help

2012-11-20 Thread Matthew Ngaha
 Traceback (most recent call last):
   File Match finder GUI.py, line 87, in ?
 app = Application(root)
   File \Match finder GUI.py, line 23, in __init__
 self.create_widgets()
   File Match finder GUI.py, line 61, in create_widgets
 self.submit_bttn = Button(self, text = Submit, command = self.reveal)
 AttributeError: Application instance has no attribute 'reveal'



i only know really basic tkinter, but i think the error is looking for
a method called reveal(). other than your __init__()  and
create_widgets() methods, i only see an update() method. I think your
update method should be named reveal?
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help

2012-11-19 Thread Matthew Ngaha
It's asking a lot if you want people to read your whole code to try
 and spot the errors. Try to run it from the console and paste what the
 errors are here.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


<    1   2   3   4   5   6   7   8   9   10   >