basic grammer error..

Discussion in 'Python' started by codefly, Dec 16, 2009.

  1. codefly

    codefly Guest

    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??
     
    codefly, Dec 16, 2009
    #1
    1. Advertising

  2. 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
     
    Diez B. Roggisch, Dec 16, 2009
    #2
    1. Advertising

  3. codefly

    codefly Guest

    On 12¿ù17ÀÏ, ¿ÀÀü12½Ã23ºÐ, "Diez B. Roggisch" <> 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.^^
     
    codefly, Dec 16, 2009
    #3
  4. codefly

    Dave Angel Guest

    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
     
    Dave Angel, Dec 16, 2009
    #4
  5. 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.
     
    Bruno Desthuilliers, Dec 16, 2009
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TLOlczyk

    Grammer for crappy HTML.

    TLOlczyk, Jul 2, 2004, in forum: HTML
    Replies:
    4
    Views:
    456
    Whitecrest
    Jul 2, 2004
  2. Venky
    Replies:
    0
    Views:
    540
    Venky
    Jun 27, 2005
  3. Colin King

    More amusing C grammer

    Colin King, Oct 10, 2005, in forum: C Programming
    Replies:
    5
    Views:
    899
    Dave Thompson
    Oct 17, 2005
  4. Pallav singh

    grammer vs precedence table

    Pallav singh, May 5, 2010, in forum: C++
    Replies:
    1
    Views:
    263
    osmium
    May 5, 2010
  5. trans.  (T. Onoma)

    [Funny] Proper grammer

    trans. (T. Onoma), Sep 19, 2004, in forum: Ruby
    Replies:
    0
    Views:
    91
    trans. (T. Onoma)
    Sep 19, 2004
Loading...

Share This Page