Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75553 > unrolled thread

Python Programing for the Absoulte Beginner

Started bySeymore4Head <Seymore4Head@Hotmail.invalid>
First post2014-08-02 18:13 -0400
Last post2014-08-03 08:55 +1000
Articles 15 — 7 participants

Back to article view | Back to comp.lang.python


Contents

  Python Programing for the Absoulte Beginner Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-02 18:13 -0400
    Re: Python Programing for the Absoulte Beginner Chris Angelico <rosuav@gmail.com> - 2014-08-03 08:30 +1000
      Re: Python Programing for the Absoulte Beginner Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-02 18:39 -0400
      Re: Python Programing for the Absoulte Beginner Steve Hayes <hayesstw@telkomsa.net> - 2014-08-03 07:11 +0200
        Re: Python Programing for the Absoulte Beginner Chris Angelico <rosuav@gmail.com> - 2014-08-03 15:12 +1000
          Re: Python Programing for the Absoulte Beginner Steve Hayes <hayesstw@telkomsa.net> - 2014-08-03 07:20 +0200
            Re: Python Programing for the Absoulte Beginner memilanuk <memilanuk@gmail.com> - 2014-08-02 22:31 -0700
            Re: Python Programing for the Absoulte Beginner Chris Angelico <rosuav@gmail.com> - 2014-08-03 15:43 +1000
            Re: Python Programing for the Absoulte Beginner Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-03 18:09 +1000
              Re: Python Programing for the Absoulte Beginner Bob Martin <bob.martin@excite.com> - 2014-08-04 07:30 +0100
                Re: Python Programing for the Absoulte Beginner Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-04 08:04 +0100
                Re: Python Programing for the Absoulte Beginner Chris Angelico <rosuav@gmail.com> - 2014-08-05 00:38 +1000
    Re: Python Programing for the Absoulte Beginner Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-02 23:31 +0100
      Re: Python Programing for the Absoulte Beginner Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-02 18:41 -0400
        Re: Python Programing for the Absoulte Beginner Chris Angelico <rosuav@gmail.com> - 2014-08-03 08:55 +1000

#75553 — Python Programing for the Absoulte Beginner

FromSeymore4Head <Seymore4Head@Hotmail.invalid>
Date2014-08-02 18:13 -0400
SubjectPython Programing for the Absoulte Beginner
Message-ID<c6oqt956g33bcass8ch5p8r8m12tjoujet@4ax.com>
https://www.google.com/webhp?hl=en&tab=ww&gws_rd=ssl#hl=en&q=python+programing+for+the+absolute+beginner

There is a book listed as a PDF.

When I try the first example of print "Game Over" I get a syntax
error.

I have tried running the command line and the GUI.  I get the feeling
there is something else I need to run.

http://imgur.com/RH3yczP

[toc] | [next] | [standalone]


#75554

FromChris Angelico <rosuav@gmail.com>
Date2014-08-03 08:30 +1000
Message-ID<mailman.12554.1407018625.18130.python-list@python.org>
In reply to#75553
On Sun, Aug 3, 2014 at 8:13 AM, Seymore4Head
<Seymore4Head@hotmail.invalid> wrote:
> https://www.google.com/webhp?hl=en&tab=ww&gws_rd=ssl#hl=en&q=python+programing+for+the+absolute+beginner
>
> There is a book listed as a PDF.
>
> When I try the first example of print "Game Over" I get a syntax
> error.
>
> I have tried running the command line and the GUI.  I get the feeling
> there is something else I need to run.
>
> http://imgur.com/RH3yczP

Try this instead:

print("Game Over")

You're looking at a Python 2 book, and you're running Python 3. I
would recommend instead getting a Python 3 tutorial:

https://docs.python.org/3/tutorial/

ChrisA

[toc] | [prev] | [next] | [standalone]


#75556

FromSeymore4Head <Seymore4Head@Hotmail.invalid>
Date2014-08-02 18:39 -0400
Message-ID<k1qqt919gf1jlhpp1gn8irpnp75a0oup4p@4ax.com>
In reply to#75554
On Sun, 3 Aug 2014 08:30:15 +1000, Chris Angelico <rosuav@gmail.com>
wrote:

>On Sun, Aug 3, 2014 at 8:13 AM, Seymore4Head
><Seymore4Head@hotmail.invalid> wrote:
>> https://www.google.com/webhp?hl=en&tab=ww&gws_rd=ssl#hl=en&q=python+programing+for+the+absolute+beginner
>>
>> There is a book listed as a PDF.
>>
>> When I try the first example of print "Game Over" I get a syntax
>> error.
>>
>> I have tried running the command line and the GUI.  I get the feeling
>> there is something else I need to run.
>>
>> http://imgur.com/RH3yczP
>
>Try this instead:
>
>print("Game Over")
>
>You're looking at a Python 2 book, and you're running Python 3. I
>would recommend instead getting a Python 3 tutorial:
>
>https://docs.python.org/3/tutorial/
>
>ChrisA
Thanks.
I was reading a little in this group and someone had recommended
trying codecademy.com

That seems to be a pretty good way to start so far.

I will also try your link.

[toc] | [prev] | [next] | [standalone]


#75577

FromSteve Hayes <hayesstw@telkomsa.net>
Date2014-08-03 07:11 +0200
Message-ID<c3hrt9p7hantiem319l23svptfeijj2i4v@4ax.com>
In reply to#75554
On Sun, 3 Aug 2014 08:30:15 +1000, Chris Angelico <rosuav@gmail.com> wrote:

>On Sun, Aug 3, 2014 at 8:13 AM, Seymore4Head
><Seymore4Head@hotmail.invalid> wrote:
>> https://www.google.com/webhp?hl=en&tab=ww&gws_rd=ssl#hl=en&q=python+programing+for+the+absolute+beginner
>>
>> There is a book listed as a PDF.
>>
>> When I try the first example of print "Game Over" I get a syntax
>> error.
>>
>> I have tried running the command line and the GUI.  I get the feeling
>> there is something else I need to run.
>>
>> http://imgur.com/RH3yczP
>
>Try this instead:
>
>print("Game Over")
>
>You're looking at a Python 2 book, and you're running Python 3. I
>would recommend instead getting a Python 3 tutorial:

Or do as I did, and install Python 2. 


-- 
Steve Hayes from Tshwane, South Africa
Web:  http://www.khanya.org.za/stevesig.htm
Blog: http://khanya.wordpress.com
E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk

[toc] | [prev] | [next] | [standalone]


#75578

FromChris Angelico <rosuav@gmail.com>
Date2014-08-03 15:12 +1000
Message-ID<mailman.12569.1407042726.18130.python-list@python.org>
In reply to#75577
On Sun, Aug 3, 2014 at 3:11 PM, Steve Hayes <hayesstw@telkomsa.net> wrote:
>>You're looking at a Python 2 book, and you're running Python 3. I
>>would recommend instead getting a Python 3 tutorial:
>
> Or do as I did, and install Python 2.

Better to install and learn Python 3. Much better.

ChrisA

[toc] | [prev] | [next] | [standalone]


#75579

FromSteve Hayes <hayesstw@telkomsa.net>
Date2014-08-03 07:20 +0200
Message-ID<0hhrt99lb6hhfh9q7mhra55d8base6eumg@4ax.com>
In reply to#75578
On Sun, 3 Aug 2014 15:12:02 +1000, Chris Angelico <rosuav@gmail.com> wrote:

>On Sun, Aug 3, 2014 at 3:11 PM, Steve Hayes <hayesstw@telkomsa.net> wrote:
>>>You're looking at a Python 2 book, and you're running Python 3. I
>>>would recommend instead getting a Python 3 tutorial:
>>
>> Or do as I did, and install Python 2.
>
>Better to install and learn Python 3. Much better.

I've got too big an investment in books on Python 2, and there are no books
available on Python 3 (I don't regard downloadable PDFs or other onlines stuff
as "books"). 




-- 
Steve Hayes from Tshwane, South Africa
Web:  http://www.khanya.org.za/stevesig.htm
Blog: http://khanya.wordpress.com
E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk

[toc] | [prev] | [next] | [standalone]


#75580

Frommemilanuk <memilanuk@gmail.com>
Date2014-08-02 22:31 -0700
Message-ID<mailman.12570.1407043890.18130.python-list@python.org>
In reply to#75579
On 08/02/2014 10:20 PM, Steve Hayes wrote:
> there are no books available on Python 3 (I don't regard downloadable PDFs
 > or other onlines stuff as "books").

That's a very broad... and very *wrong* statement.



-- 
Shiny!  Let's be bad guys.

Reach me @ memilanuk (at) gmail dot com

[toc] | [prev] | [next] | [standalone]


#75581

FromChris Angelico <rosuav@gmail.com>
Date2014-08-03 15:43 +1000
Message-ID<mailman.12571.1407044637.18130.python-list@python.org>
In reply to#75579
On Sun, Aug 3, 2014 at 3:20 PM, Steve Hayes <hayesstw@telkomsa.net> wrote:
> On Sun, 3 Aug 2014 15:12:02 +1000, Chris Angelico <rosuav@gmail.com> wrote:
>
>>On Sun, Aug 3, 2014 at 3:11 PM, Steve Hayes <hayesstw@telkomsa.net> wrote:
>>>>You're looking at a Python 2 book, and you're running Python 3. I
>>>>would recommend instead getting a Python 3 tutorial:
>>>
>>> Or do as I did, and install Python 2.
>>
>>Better to install and learn Python 3. Much better.
>
> I've got too big an investment in books on Python 2, and there are no books
> available on Python 3 (I don't regard downloadable PDFs or other onlines stuff
> as "books").

But there are plenty of courses for Python 3, and lots of people are
happy to take online information when learning coding. (Personally, I
can't be bothered with paper books at all. I get all my books online
if I possibly can... or even get both, pay for the paper one to
support the author, and then download it so I have something I can
actually read and search.)

Don't tie yourself to the Python branch that's not getting development
(bugfixes, some IDLE enhancements, but no new features) unless you
have a good reason to. For someone who's just starting out with
Python, learn Python 3. Don't bother going into all the debates; if
you have need of Python 2, you'll find out when the time comes; and
when it does, you'll be better placed for having learned Python 3.

ChrisA

[toc] | [prev] | [next] | [standalone]


#75582

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2014-08-03 18:09 +1000
Message-ID<53ddee30$0$29976$c3e8da3$5496439d@news.astraweb.com>
In reply to#75579
Steve Hayes wrote:

> I've got too big an investment in books on Python 2, and there are no
> books available on Python 3 (I don't regard downloadable PDFs or other
> onlines stuff as "books").

I love Python 3, it's way better than Python 2, and there's less and less
reason to stick to Python 2 now. You really should learn Python 3, you
won't be sorry.

But, if you choose not to, there's nothing to be ashamed of. Python 2.7 has
got at least six years of life left in it, and when you're done with it,
migrating to Python 3 isn't like learning a new language. It's more like
the difference between American and British English.


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#75664

FromBob Martin <bob.martin@excite.com>
Date2014-08-04 07:30 +0100
Message-ID<c48njcFihspU1@mid.individual.net>
In reply to#75582
in 726123 20140803 090919 Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote:
>Steve Hayes wrote:
>
>> I've got too big an investment in books on Python 2, and there are no
>> books available on Python 3 (I don't regard downloadable PDFs or other
>> onlines stuff as "books").
>
>I love Python 3, it's way better than Python 2, and there's less and less
>reason to stick to Python 2 now. You really should learn Python 3, you
>won't be sorry.
>
>But, if you choose not to, there's nothing to be ashamed of. Python 2.7 has
>got at least six years of life left in it, and when you're done with it,
>migrating to Python 3 isn't like learning a new language. It's more like
>the difference between American and British English.

With American English being 2.7 ??
Sorry, but someone had to ask  :-)

[toc] | [prev] | [next] | [standalone]


#75668

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2014-08-04 08:04 +0100
Message-ID<mailman.12624.1407135913.18130.python-list@python.org>
In reply to#75664
On 04/08/2014 07:30, Bob Martin wrote:
> in 726123 20140803 090919 Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote:
>> Steve Hayes wrote:
>>
>>> I've got too big an investment in books on Python 2, and there are no
>>> books available on Python 3 (I don't regard downloadable PDFs or other
>>> onlines stuff as "books").
>>
>> I love Python 3, it's way better than Python 2, and there's less and less
>> reason to stick to Python 2 now. You really should learn Python 3, you
>> won't be sorry.
>>
>> But, if you choose not to, there's nothing to be ashamed of. Python 2.7 has
>> got at least six years of life left in it, and when you're done with it,
>> migrating to Python 3 isn't like learning a new language. It's more like
>> the difference between American and British English.
>
> With American English being 2.7 ??
> Sorry, but someone had to ask  :-)
>

American English is Python 4 :)

The original English is Python 0.1.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#75694

FromChris Angelico <rosuav@gmail.com>
Date2014-08-05 00:38 +1000
Message-ID<mailman.12645.1407163118.18130.python-list@python.org>
In reply to#75664
On Mon, Aug 4, 2014 at 3:30 PM, Bob Martin <bob.martin@excite.com> wrote:
> With American English being 2.7 ??
> Sorry, but someone had to ask  :-)

A fairer comparison would be American English is IronPython, British
English is PyPy. Mostly compatible, and people call them both Python,
but not strictly identical.

ChrisA

[toc] | [prev] | [next] | [standalone]


#75555

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2014-08-02 23:31 +0100
Message-ID<mailman.12555.1407018707.18130.python-list@python.org>
In reply to#75553
On 02/08/2014 23:13, Seymore4Head wrote:
> https://www.google.com/webhp?hl=en&tab=ww&gws_rd=ssl#hl=en&q=python+programing+for+the+absolute+beginner
>
> There is a book listed as a PDF.
>
> When I try the first example of print "Game Over" I get a syntax
> error.
>
> I have tried running the command line and the GUI.  I get the feeling
> there is something else I need to run.
>
> http://imgur.com/RH3yczP
>

If the book is for Python 2 and you have 3.3 it should be print("Game Over")

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#75557

FromSeymore4Head <Seymore4Head@Hotmail.invalid>
Date2014-08-02 18:41 -0400
Message-ID<j5qqt99i5a0jtq0gttbea3a9nrnq0ak9ns@4ax.com>
In reply to#75555
On Sat, 02 Aug 2014 23:31:35 +0100, Mark Lawrence
<breamoreboy@yahoo.co.uk> wrote:

>On 02/08/2014 23:13, Seymore4Head wrote:
>> https://www.google.com/webhp?hl=en&tab=ww&gws_rd=ssl#hl=en&q=python+programing+for+the+absolute+beginner
>>
>> There is a book listed as a PDF.
>>
>> When I try the first example of print "Game Over" I get a syntax
>> error.
>>
>> I have tried running the command line and the GUI.  I get the feeling
>> there is something else I need to run.
>>
>> http://imgur.com/RH3yczP
>>
>
>If the book is for Python 2 and you have 3.3 it should be print("Game Over")

Thanks

I am sure they had a good reason to add using 2 more characters for
doing the same job.

[toc] | [prev] | [next] | [standalone]


#75559

FromChris Angelico <rosuav@gmail.com>
Date2014-08-03 08:55 +1000
Message-ID<mailman.12556.1407020139.18130.python-list@python.org>
In reply to#75557
On Sun, Aug 3, 2014 at 8:41 AM, Seymore4Head
<Seymore4Head@hotmail.invalid> wrote:
>>If the book is for Python 2 and you have 3.3 it should be print("Game Over")
>
> Thanks
>
> I am sure they had a good reason to add using 2 more characters for
> doing the same job.

One more, since you'll normally have a space after the word "print" anyway. :)

Language keywords are inflexible. Sure, it's nice and simple to do
straightforward output, but when you want to send that to stderr
instead of stdout, or change the separator between args, or change
what's at the end of what's printed (a newline, normally), or anything
like that, there needs to be special magical syntax added. Plus, it's
nearly impossible to do a simple replacement of print with something
else; pretty much the only way is to play with the code as it's being
compiled. With a function, all that is fixed; there are standard ways
of providing extra information (keyword arguments), you can replace
print with any other function just by shadowing it, and all this can
be done with perfectly normal syntax. This is how to tee print to a
file as well as stdout:

log_file = open("print.log","w")
orig_print = print
def print(*args, **kw):
    if "file" not in kw: orig_print(*args, **kw, file=log_file)
    orig_print(*args, **kw)

So easy! You can grab a reference to the original print functionality
with ordinary assignment (functions can be passed around and
referenced by names; statements can't), you can replace it just by
creating something else of the same name, and all its magic just comes
through as arguments.

There has been a move, now and then, to allow parens-free function
calls. If some such scheme were accepted, you could then use the
Python 2 syntax, and it would call the function; additionally, you
could use the shorthand for any other function, too - "sys.exit 1" for
instance. So far, there hasn't been a proposal that's satisfied all
the requirements and given a compelling argument for acceptance, but I
don't think the Python devs are philosophically opposed to the
concept.

ChrisA

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web