Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > basic grammer error..

Reply
Thread Tools

basic grammer error..

 
 
codefly
Guest
Posts: n/a
 
      12-16-2009
class codefly:

def WaitFreecatz(self, hours):
hours = self.hours
i = 1
while i < hours:
print 'i wait %s hours' %(i)
i = i+1
if i == hours:
print '\nhe never comes'


run error// what's wrong??
 
Reply With Quote
 
 
 
 
Diez B. Roggisch
Guest
Posts: n/a
 
      12-16-2009
codefly wrote:

> class codefly:
>
> def WaitFreecatz(self, hours):
> hours = self.hours
> i = 1
> while i < hours:
> print 'i wait %s hours' %(i)
> i = i+1
> if i == hours:
> print '\nhe never comes'
>
>
> run error// what's wrong??


Next time, be so kind to tell us what the actual error *is*, will you?

Because there is none for me after c'n'p-ing that code into a source-file...

Diez
 
Reply With Quote
 
 
 
 
codefly
Guest
Posts: n/a
 
      12-16-2009
On 12월17일, 오전12시23분, "Diez B. Roggisch" <(E-Mail Removed)> wrote:
> codefly wrote:
> > class codefly:

>
> > def WaitFreecatz(self, hours):
> > hours = self.hours
> > i = 1
> > while i < hours:
> > print 'i wait %s hours' %(i)
> > i = i+1
> > if i == hours:
> > print '\nhe never comes'

>
> > run error// what's wrong??

>
> Next time, be so kind to tell us what the actual error *is*, will you?
>
> Because there is none for me after c'n'p-ing that code into a source-file....
>
> Diez


Thank you Sir.^^
 
Reply With Quote
 
Dave Angel
Guest
Posts: n/a
 
      12-16-2009
codefly wrote:
> class codefly:
>
> def WaitFreecatz(self, hours):
> hours = self.hours
> i = 1
> while i < hours:
> print 'i wait %s hours' %(i)
> i = i+1
> if i == hours:
> print '\nhe never comes'
>
>
> run error// what's wrong??
>
>

You can't get a runtime error there, because nothing instantiates the
class, nor calls its method. Once you add that code, you'll find an
uninitialized instance attribute, plus a couple of logic errors.

So, if you actually have a question, how about stating it completely?
Given a complete code sample, you run it (on what version of what
computer language, on what OS), and you get some error (show complete
traceback). Explain what you tried, to identify the error, and then
state what has you stumped.

And if you don't get a Python error, but get the wrong results, then
state what you expected, and what you got.

DaveA

 
Reply With Quote
 
Bruno Desthuilliers
Guest
Posts: n/a
 
      12-16-2009
codefly a crit :
> class codefly:
>
> def WaitFreecatz(self, hours):
> hours = self.hours
> i = 1
> while i < hours:
> print 'i wait %s hours' %(i)
> i = i+1
> if i == hours:
> print '\nhe never comes'
>
>
> run error// what's wrong??


wrt/ the code : bad capitalisation on the class name and method name,
access to an inexistant attribute, useless param 'hours' (not used),
failure to use the appropriate iteration construct.

wrt/ your post: failure to post both the full traceback and the minimal
required code to produce this traceback.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CORRECTING GRAMMER AND SPELLING REALLY DOES NOT MATTER HERE IS PRO =?Utf-8?B?SVQtTU9ORVk=?= MCSE 5 02-12-2007 05:29 PM
More amusing C grammer Colin King C Programming 5 10-17-2005 02:16 AM
Representing BNF grammer using XML Venky XML 0 06-27-2005 05:15 PM
Grammer checker. Nowt Computer Support 1 06-14-2005 09:24 PM
Grammer for crappy HTML. TLOlczyk HTML 4 07-02-2004 11:16 AM



Advertisments