Re: Re Following syntax error in Mac OX10.7 Terminal

2012-06-29 Thread David Thomas
On Thursday, June 28, 2012 6:30:42 PM UTC+1, Sergi Pasoev wrote:
 You just have to consider that indentation matters in Python, so you
 have to type the code in Python interpreter as you have written it
 below, that is, press Tab before each line when you are inside the
 'while (or any other like for, if, with, etc.) block.
 
 a=0
 while a10:
 a=a+1
 print a 
 
 I can guess from your message that you aren't aware of one very
 important Python feature, and maybe you also didn't willingly choose to
 learn Python2 instead of Python3 ? In this case I would advise you to
 consider both versions before choosing.

Hi yeah I'm currently learning python 2 at the moment and the tutorial that I 
am studying doesn't explain about indentation.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re Following syntax error in Mac OX10.7 Terminal

2012-06-29 Thread MRAB

On 29/06/2012 16:13, David Thomas wrote:

On Thursday, June 28, 2012 6:30:42 PM UTC+1, Sergi Pasoev wrote:

You just have to consider that indentation matters in Python, so you
have to type the code in Python interpreter as you have written it
below, that is, press Tab before each line when you are inside the
'while (or any other like for, if, with, etc.) block.

a=0
while a10:
a=a+1
print a

I can guess from your message that you aren't aware of one very
important Python feature, and maybe you also didn't willingly choose to
learn Python2 instead of Python3 ? In this case I would advise you to
consider both versions before choosing.


Hi yeah I'm currently learning python 2 at the moment and the tutorial that
I am studying doesn't explain about indentation.


Really? Indentation is a basic feature of Python!
--
http://mail.python.org/mailman/listinfo/python-list


Re: Re Following syntax error in Mac OX10.7 Terminal

2012-06-29 Thread David Thomas
On Friday, June 29, 2012 4:21:56 PM UTC+1, MRAB wrote:
 On 29/06/2012 16:13, David Thomas wrote:
  On Thursday, June 28, 2012 6:30:42 PM UTC+1, Sergi Pasoev wrote:
  You just have to consider that indentation matters in Python, so you
  have to type the code in Python interpreter as you have written it
  below, that is, press Tab before each line when you are inside the
  'while (or any other like for, if, with, etc.) block.
 
  a=0
  while a10:
  a=a+1
  print a
 
  I can guess from your message that you aren't aware of one very
  important Python feature, and maybe you also didn't willingly choose to
  learn Python2 instead of Python3 ? In this case I would advise you to
  consider both versions before choosing.
 
  Hi yeah I'm currently learning python 2 at the moment and the tutorial that
  I am studying doesn't explain about indentation.
 
 Really? Indentation is a basic feature of Python!

while {condition that the loop continues}:
{what to do in the loop}
{have it indented, usually four spaces}
{the code here is not looped}
{because it isn't indented}

Just discovered this in the tutorial further down.  I'm currently learning 
Python 2 because there seems to be a lot of tutorials out there covering Python 
2 rather than 3.

Thanks for the help this community is great for help.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re Following syntax error in Mac OX10.7 Terminal

2012-06-29 Thread Ben Finney
David Thomas dthoma...@me.com writes:

 Hi yeah I'm currently learning python 2 at the moment and the tutorial
 that I am studying doesn't explain about indentation.

You might be better served by the official Python tutorial
URL:http://docs.python.org/tutorial/.

If you work through it from beginning to end, doing each exercise and
experimenting to be sure you understand before moving through, you will
get a good grounding in the fundamentals of the language.

-- 
 \   “Don't worry about what anybody else is going to do. The best |
  `\ way to predict the future is to invent it.” —Alan Kay |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re Re Following syntax error in Mac OX10.7 Terminal

2012-06-29 Thread Sergi Pasoev

 Just discovered this in the tutorial further down. I'm currently
 learning Python 2 because there seems to be a lot of tutorials out there
 covering Python 2 rather than 3.

While deciding which version of Python to learn, a better counsel could
be found here:

http://wiki.python.org/moin/Python2orPython3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re Following syntax error in Mac OX10.7 Terminal

2012-06-29 Thread Andrew Berg
On 6/29/2012 10:58 AM, David Thomas wrote:
 Just discovered this in the tutorial further down.  I'm currently learning 
 Python 2 because there seems to be a lot of tutorials out there covering 
 Python 2 rather than 3.
The latest edition (3rd?) of Programming Python by Mark Lutz covers py3k
(it targets 3.0/3.1 IIRC, but the official Python docs cover the
differences between versions). The tutorial in the official docs is
short compared to a book, but it covers the basics well. The official
docs do cover each module in the standard library in great detail. It is
mainly reference, though there are a few tutorials (e.g. the logging
module has at least 2 tutorials).

If you are not restricted to 2.x, learn 3.2/3.3. 2.x is used mainly
because some major libraries (e.g., Twisted, Django) and/or other
dependencies do not support 3.x yet. There will be no 2.8, and 2.7 isn't
getting any new features AFAIK.
-- 
CPython 3.3.0a4 | Windows NT 6.1.7601.17803
-- 
http://mail.python.org/mailman/listinfo/python-list