[Tutor] [Fwd: Re: trouble with "if"]
Adam Urbas
jped.aru at gmail.com
Wed May 30 17:01:28 CEST 2007
I can't exactly show you the error message anymore, because the program is
now screwed up in so many ways that I can't even get it to do the things it
used to.
It says things like ERROR: Inconsistent indentation detected!
1) Your indentation is outright incorrect (easy to fix), OR
2) Your indentation mixes tabs and spaces. Then it tells me to untabify
everything, which i did and it still gives this message. I've started
completely over with the exact same indentation and that one works.
Oh my gosh this gmail is a fricken crack head... none of this stuff was here
last night. I have no idea what was going on then, but everything you guys
said is right here. The plain text is right next to the Check spelling, the
reply to all is right above send and save now and in the corner near the
little arrow. Well, it's working now.
Ok, so if i have a section of code that is:
answer=(2+3):
print "answer", answer
so for the code above I would put: (I think I would have to have the two
numbers and the addition thing in there wouldn't I; I saw something like
this on Alan's tutorial last night.)
def answer(2,3):
answer=(2+3)
print "answer",answer
That is obviously not right.:
There's an error in your program:
invalid syntax
when it says that it highlights the 2: def answer(2+3):
Ok I think I understand these now. Thanks for the advice. I have this now:
def answer():
print("answer")
answer()
It works too, yay!
Thanks,
Au
On 5/30/07, Andre Engels <andreengels at gmail.com> wrote:
>
> 2007/5/30, Brian van den Broek <broek at cc.umanitoba.ca>:
> > Another fwd, folks.
> >
> > Brian vdB
> >
> > -------- Original Message --------
> > Subject: Re: [Tutor] trouble with "if"
> > Date: Tue, 29 May 2007 23:28:46 -0500
> > From: Adam Urbas <jped.aru at gmail.com>
> > To: Brian van den Broek <broek at cc.umanitoba.ca>
> > References: <BAY103-W11DE2E62FD41449A952D68B12F0 at phx.gbl>
> > <465C64A4.60602 at cc.umanitoba.ca>
> > <ef52818c0705292107n1ee0c105k54c02ccf4d85f7c6 at mail.gmail.com>
> >
> > I'm having trouble with the parentheses after the def thing(). IDLE
> > says that there is something wrong with it. If I type something
> > between them, it says that there is something wrong with the quotation
> > marks. If I just leave it like (), then it says that something is
> > wrong with what is after the parentheses. Unless my code is supposed
> > to go between the parentheses. I'll try that.
>
> Between the parentheses should go the variables you use (if any) when
> calling the function. For example:
>
> def sayhello():
> print "Hello"
>
> You don't have any parameters here, so there's nothing between the
> brackets
>
> def say(word):
> print word
>
> Now there is one parameter, namely word.
>
> def sayboth(word1,word2):
> print word1
> print word2
>
> Here there are two parameters, word1 and word2.
>
> The number of parameters should be the same as the number of
> parameters you use when calling the function:
>
> sayhello()
> say("One text")
> sayboth("One text","Another text")
>
> There is a much used method to make some of the parameters optional,
> but we'll not go into that.
>
> To know what is going wrong with your program, I would have to see the
> program (or a simplified version of it that still goes wrong) and
> preferably also the exact error message you are getting.
>
>
> --
> Andre Engels, andreengels at gmail.com
> ICQ: 6260644 -- Skype: a_engels
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070530/af433e73/attachment.html
More information about the Tutor
mailing list