Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Getting started with IDLE and Python - no highlighting and no execution

Received: by 10.180.96.42 with SMTP id dp10mr889785wib.2.1344223021844;
        Sun, 05 Aug 2012 20:17:01 -0700 (PDT)
Received: by 10.66.74.225 with SMTP id x1mr1087335pav.45.1344220349668;
        Sun, 05 Aug 2012 19:32:29 -0700 (PDT)
Path: q11ni60442355wiw.1!nntp.google.com!r1no3871872qas.0!news-out.google.com!p10ni19426216pbh.1!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!p8g2000yqa.googlegroups.com!not-for-mail
From: PeterSo <ojl...@gmail.com>
Newsgroups: comp.lang.python
Subject: Re: Getting started with IDLE and Python - no highlighting and no execution
Date: Sun, 5 Aug 2012 19:17:54 -0700 (PDT)
Organization: http://groups.google.com
Lines: 78
Message-ID: <89c5285b-5f3a-4195-9dcb-f24a098cb670@p8g2000yqa.googlegroups.com>
References: <d07282d6-1666-4230-bf46-c0942ef9a390@r7g2000yqr.googlegroups.com> <jvn1vr$ln6$1@dont-email.me>
NNTP-Posting-Host: 68.1.120.35
Mime-Version: 1.0
X-Trace: posting.google.com 1344220349 1026 127.0.0.1 (6 Aug 2012 02:32:29 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 6 Aug 2012 02:32:29 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: p8g2000yqa.googlegroups.com; posting-host=68.1.120.35; posting-account=DflkpwoAAAD8sNvq_RGrZysDSXckRrOm
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.0; rv:14.0) Gecko/20100101 Firefox/14.0.1,gzip(gfe)
Bytes: 3464
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On Aug 5, 7:09=A0pm, Rotwang <sg...@hotmail.co.uk> wrote:
> On 06/08/2012 00:46, PeterSo wrote:
>
>
>
>
>
>
>
>
>
> > I am just starting to learn Python, and I like to use the editor
> > instead of the interactive shell. So I wrote the following little
> > program in IDLE
>
> > # calculating the mean
>
> > data1=3D[49, 66, 24, 98, 37, 64, 98, 27, 56, 93, 68, 78, 22, 25, 11]
>
> > def mean(data):
> > =A0 =A0return sum(data)/len(data)
>
> > mean(data1)
>
> > There is no syntax highlighting and when I ran it F5, I got the
> > following in the shell window.
>
> > =A0 >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RESTART
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> > Any ideas?
>
> I don't know what editor you're using or how it works, but I'm guessing
> that pressing f5 runs what you've written as a script, right? In that
> case the interpreter doesn't automatically print the result of
> expressions in the same way that the interactive interpreter does; you
> didn't tell it to print anything, so it didn't.
>
> > If I added print mean(data1), it gave me a invalid syntax
>
> > # calculating the mean
>
> > data1=3D[49, 66, 24, 98, 37, 64, 98, 27, 56, 93, 68, 78, 22, 25, 11]
> > data2=3D[1,2,3,4,5]
>
> > def mean(data):
> > =A0 =A0return sum(data)/len(data)
>
> > mean(data1)
> > print mean(data1)
>
> If you're using Python 3.x, you'll need to replace
>
> print mean(data1)
>
> with
>
> print(mean(data1))
>
> since the print statement has been replaced with the print function in
> Python 3.
>
> If you're instead using Python 2.x then I don't know what the problem
> is, but in that case your mean() function won't work properly - the
> forward slash operator between a pair of ints gives you floor division
> by default, so you should instead have it return something like
> float(sum(data))/len(data).
>
> --
> I have made a thing that superficially resembles music:
>
> http://soundcloud.com/eroneity/we-berated-our-own-crapiness

Your right, it is v 3 so print(mean(data1)) worked.
Thanks.
I still do not have any highlighting in the IDLE editor.