Re: [Tutor] From Newbie

2008-06-22 Thread paul
hi Danny,As far as i am aware you must declare your variable first, something like a=0The same would go for shope that helpspaulOn Sun Jun 22 10:45 , Danny Laya  sent:Hi ! I have learned wiki tutor for non-programmer and I found some hill that stopping me. In  Non-Programmer's Tutorial for Python/Count to 10, wiki ask me to write this code :a = 1s = 0print 'Enter Numbers to add to the sum.'print 'Enter 0 to quit.'while a != 0:print 'Current Sum:', sa = int(raw_input('Number? '))s = s + aprint 'Total Sum =', sBut when i write while a != 0: and then i press enter, python terminal tell me :>>> while a ! = 0:  File "", line 1while a ! = 0:^SyntaxError: invalid syntaxCan you
 find my mistake, guys ? Sorry to bother you, I try to find the answer in google, but I can't found the answer.Please help me soon guys, whatever your answer. If you don'twant to answer my question, please give me some site that couldanswer this newbie question. Thank's.  

  
 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] From Newbie

2008-06-22 Thread Danny Laya



 Few... Thanks all, i have found the wrong, i miss some space between != and 0. 
Thank's for the help. I really apreciate it !
 


   ___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] From Newbie

2008-06-22 Thread bhaaluu
On Sun, Jun 22, 2008 at 6:45 AM, Danny Laya <[EMAIL PROTECTED]> wrote:
> Hi ! I have learned wiki tutor for non-programmer and I found some hill that
> stopping me. In  Non-Programmer's Tutorial for Python/Count to 10, wiki ask
> me to write this code :
>
> a = 1
> s = 0
> print 'Enter Numbers to add to the sum.'
> print 'Enter 0 to quit.'
> while a != 0:
> print 'Current Sum:', s
> a = int(raw_input('Number? '))
> s = s + a
> print 'Total Sum =', s
>

The above code, copy/pasted to a file, and run from the command-line
gives the following output:

Enter Numbers to add to the sum.
Enter 0 to quit.
Current Sum: 0
Number? 1
Current Sum: 1
Number? 2
Current Sum: 3
Number? 3
Current Sum: 6
Number? 4
Current Sum: 10
Number? 0
Total Sum = 10

> But when i write while a != 0: and then i press enter,
> python terminal tell me :
 while a ! = 0:
>   File "", line 1
> while a ! = 0:
> ^
> SyntaxError: invalid syntax
>
> Can you
>  find my mistake, guys ? Sorry to bother you, I try to
> find the answer in google, but I can't found the answer.
> Please help me soon guys, whatever your answer. If you don't
> want to answer my question, please give me some site that could
> answer this newbie question. Thank's.
>

The syntax error seems to be the space between the '!' and the '='.
'!=' means 'does not equal'

'! =' doesn't mean anything, thus, the syntax error.

When you're beginning, you'll make plenty of errors like that.
Stop and read the error carefully, then look at the code closely.

As you gain experience, you'll learn to see those nit-picky syntax errors.
It doesn't matter which computer programming language you start out with,
each one has a specific syntax that must be followed, or you'll get syntax
errors. Python is very friendly, and the error messages it gives you are
much more helpful than other languages.

Happy Programming!
-- 
b h a a l u u at g m a i l dot c o m
Kid on Bus: What are you gonna do today, Napoleon?
Napoleon Dynamite: Whatever I feel like I wanna do. Gosh!
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] From Newbie

2008-06-22 Thread broek




But when i write while a != 0: and then i press enter,
python terminal tell me :

while a ! = 0:

  File "", line 1
while a ! = 0:
^
SyntaxError: invalid syntax

Can you find my mistake, guys ? Sorry to bother you, I try to



Hi,

Python's trying to give you a hint:


while a ! = 0:
^
SyntaxError: invalid syntax


So, there's something it doesn't like around the `!' character.  
Compare the error message to what you say you wrote:



while a != 0:


Notice any differences?

Best,

Brian vdB
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor