[Tutor] Fwd: Puzzle - Next Step to our interviewing process - Pramati Technologies!

2014-04-14 Thread Sunil Tech
Kindly assess the problem carefully including all the possibilities, including but not limited to: 1. Menu directly available(1 item or all items). 2. Menu available but distributed over multiple items. 3. Menu need not be present in all restaurants listed. 4. Menu not available at all. Ple

Re: [Tutor] reading a csv file

2014-04-14 Thread Sunil Tech
Please ignore previous email. this error occurred as i had previously created .pyc file... after deleting that .pyc file.. now it is working fine. Thank you. On Tue, Apr 15, 2014 at 11:36 AM, Sunil Tech wrote: > Hi, > > #!/usr/bin/python > > import csv > import sys > > def main(): > cr =

[Tutor] reading a csv file

2014-04-14 Thread Sunil Tech
Hi, #!/usr/bin/python import csv import sys def main(): cr = csv.reader(open("data.csv","rb")) for row in cr: print row if __name__ == "__main__": sys.exit(main()) when i run this... i get Traceback (most recent call last): File "data.py", line 14, in sys.exit(ma

Re: [Tutor] Why should modules or packages should define their own domain-specific base exception class?

2014-04-14 Thread bob gailer
On 4/14/2014 10:09 PM, brian arb wrote: I don't quite understand why the google python style guide recommends that packages and modules we write should avoid using the catch-all except. Instead the guide encourages you to write domain specific exception classes. class Error(Exception): """.

[Tutor] Why should modules or packages should define their own domain-specific base exception class?

2014-04-14 Thread brian arb
I don't quite understand why the google python style guide recommends that packages and modules we write should avoid using the catch-all except. Instead the guide encourages you to write domain specific exception classes. class Error(Exception): """...""" class ThisSpecificError(Error): """.

Re: [Tutor] Python & algorithms (Lang line simplification algorithm)

2014-04-14 Thread Ben Finney
Laura Kauria writes: > Thanks a lot for all the help! I got the courage to start at least.. Congratulations! Courage is a necessary ingredient when starting :-) Could you please avoid top-posting, and instead use interleaved style https://en.wikipedia.org/wiki/Posting_style#Interleaved_style>

Re: [Tutor] Python & algorithms (Lang line simplification algorithm)

2014-04-14 Thread Alan Gauld
On 14/04/14 21:21, Laura Kauria wrote: line = new Line( pointList[startPoint], pointList[endPoint]) line = Line(pointList[startPoint], pointList[endPoint]) is the translation. But that probably doesn't help much. I've done point list and indexes already, put don't know how to create the lin

Re: [Tutor] Python & algorithms (Lang line simplification algorithm)

2014-04-14 Thread Alan Gauld
On 14/04/14 16:30, Laura Kauria wrote: I need to create a line between two points and then check what is the distance between a line and intermediate points which were between lines start and end point. When you say you want to "create a line" what do you mean? Do you want to - create a line i

Re: [Tutor] Python & algorithms (Lang line simplification algorithm)

2014-04-14 Thread Laura Kauria
Hi, sorry I don't know the conventions yet. I'd need to know how to create a line between two points. I don't know after many hours checking, how to convert this pseudocode to python. line = new Line( pointList[startPoint], pointList[endPoint]) I've done point list and indexes already, put don'

Re: [Tutor] python errors

2014-04-14 Thread ALAN GAULD
From: keith papa >To: Alan Gauld >Sent: Monday, 14 April 2014, 18:19 >Subject: RE: [Tutor] python errors > > > > x = "foo" - 4 > > >Traceback (most recent call last): >  File "", line 1, in >    x = "foo" - 4 >TypeError: unsupported operand type(s) for -: 'str' and 'int'   > >That's

Re: [Tutor] Python & algorithms (Lang line simplification algorithm)

2014-04-14 Thread bob gailer
On 4/14/2014 11:30 AM, Laura Kauria wrote: Thanks a lot for all the help! I got the courage to start at least.. Some requests regarding posts. 1) put your comments following the relevant text rather than at the top. 2) delete old (irrelevant) text. 4) be more clear with your questions. I star

Re: [Tutor] python errors

2014-04-14 Thread Alan Gauld
On 14/04/14 12:53, keith papa wrote: Hi am a new to programming and I reading the book "Think python" am on chapter one and it mentioned some errors I need to look out for like: Syntax errors, Runtime errors and semantic errors. I wanted to know if you guys have some examples of the errors? Yo

Re: [Tutor] Python & algorithms (Lang line simplification algorithm)

2014-04-14 Thread Laura Kauria
Thanks a lot for all the help! I got the courage to start at least.. I started by converting the pseudocode I had to python. Still I have problems with perpendicular distance and creating a line with python. I need to create a line between two points and then check what is the distance between a

[Tutor] python errors

2014-04-14 Thread keith papa
Hi am a new to programming and I reading the book "Think python" am on chapter one and it mentioned some errors I need to look out for like: Syntax errors, Runtime errors and semantic errors. I wanted to know if you guys have some examples of the errors?