Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'turtle': 0.07; 'subject:help': 0.08; 'doing?': 0.09; 'seemed': 0.09; 'cc:addr :python-list': 0.11; 'def': 0.12; 'question.': 0.14; '23,': 0.16; 'call?': 0.16; 'function?': 0.16; 'skip:f 130': 0.16; 'suggested,': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'wrote:': 0.18; 'basically': 0.19; 'received:10.0.1': 0.19; 'seems': 0.21; 'feb': 0.22; 'example': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'sorry,': 0.24; 'math': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'forgot': 0.30; 'skip:( 20': 0.30; 'code': 0.31; 'easier': 0.31; 'about.': 0.31; "d'aprano": 0.31; 'long.': 0.31; 'steven': 0.31; 'though.': 0.31; 'could': 0.34; 'but': 0.35; 'add': 0.35; 'there': 0.35; 'really': 0.36; 'received:10.0': 0.36; 'half': 0.37; 'received:10': 0.37; 'anything': 0.39; 'sure': 0.39; 'range': 0.61; 'header:Message-Id:1': 0.63; 'show': 0.63; 'more': 0.64; 'school': 0.64; 'talking': 0.65; 'charset:windows-1252': 0.65; '2014,': 0.84; 'haven\x92t': 0.84; 'it\x92s': 0.84; 'semi': 0.84 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020208.530A9F5E.004A,ss=1,re=0.000,fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=2.0 cv=H/cFNZki c=1 sm=1 a=MB85R812cvcrhCHz/P2OVA==:17 a=G8Uczd0VNMoA:10 a=kviXuzpPAAAA:8 a=dLIZIbpXczQA:10 a=kZ7UWmmPAAAA:8 a=M7VDbUzA2QW1TpOyeUIA:9 a=pILNOxqGKmIA:10 a=pyH5b1fOeEsA:10 a=E-FPbRvkMWnAl7Eqj_8A:9 a=_W_S_7VecoQA:10 a=MB85R812cvcrhCHz/P2OVA==:117 X-CM-Score: 0.00 Authentication-Results: cox.net; auth=pass (PLAIN) smtp.auth=swdunning@cox.net Content-Type: multipart/alternative; boundary="Apple-Mail=_0D378C84-1A43-42CB-9B80-77125A69D252" Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: Functions help From: Scott W Dunning In-Reply-To: Date: Sun, 23 Feb 2014 18:24:44 -0700 References: To: Steven D'Aprano X-Mailer: Apple Mail (2.1827) Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 301 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393205088 news.xs4all.nl 2869 [2001:888:2000:d::a6]:48758 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66957 --Apple-Mail=_0D378C84-1A43-42CB-9B80-77125A69D252 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Feb 23, 2014, at 1:44 AM, Steven D'Aprano = wrote: >=20 > Sorry, I don't really understand your question. Could you show an = example=20 > of what you are doing? >=20 > Do you mean "add 5" or "*5"? "Add *5 doesn't really mean anything to = me. Sorry I forgot to add the code that I had to give an example of what I = was talking about. I=92ll put it below, sorry that it=92s so long. A = couple of people have basically answered my question though. I take it = was I was talking about was a loop, which I haven=92t learned in school = yet but, it seems semi self-explanatory. As you can see I added a loop = in there about half way down the code (i put it in bold) and it seemed = to do what I want. Now I=92m going to try and do what Rhodri suggested, = a range function? I=92m not sure exactly what that=92ll do but I think = it=92ll clean up my code more and make things easier to call? =20 from turtle import * from math import sin, sqrt, radians def star(width): R =3D (width)/(2*sin(radians(72))) A =3D (2*width)/(3+sqrt(5)) penup() left(18) penup() forward(R) pendown() =20 left(162) forward(A) right(72) forward(A) left(144) forward(A) right(72) forward(A) left(144) forward(A) right(72) forward(A) left(144) forward(A) right(72) forward(A) left(144) forward(A) right(72) forward(A) penup() left(162) forward(R) left(162) =20 showturtle() def fillstar(color): fillcolor(color) begin_fill() star(25) end_fill() =20 red =3D "red" fillstar(red) def space(width): penup() forward(2*width) pendown() space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) def row(width): penup() right(90) forward(width) right(90) forward(11*width) right(180) pendown() row(25) for i in range (5): fillstar(red) space(25) row(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) row(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) row(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) row(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) row(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) row(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) row(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) fillstar(red) space(25) --Apple-Mail=_0D378C84-1A43-42CB-9B80-77125A69D252 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1252
On Feb 23, 2014, at 1:44 AM, Steven = D'Aprano <steve+comp.lang.pytho= n@pearwood.info> wrote:

Sorry, = I don't really understand your question. Could you show an example =
of what you are doing?

Do you mean "add 5" or "*5"? =  "Add *5 doesn't really mean anything to = me.
Sorry I forgot to add the code that I had to = give an example of what I was talking about.  I=92ll put it below, = sorry that it=92s so long.  A couple of people have basically = answered my question though.  I take it was I was talking about was = a loop, which I haven=92t learned in school yet but, it seems semi = self-explanatory.   As you can see I added a loop in there about = half way down the code (i put it in bold) and it seemed to do what I = want.  Now I=92m going to try and do what Rhodri suggested, a range = function?  I=92m not sure exactly what that=92ll do but I think = it=92ll clean up my code more and make things easier to call? =  

from turtle import *
from math = import sin, sqrt, radians

def = star(width):
    R =3D = (width)/(2*sin(radians(72)))
    A =3D = (2*width)/(3+sqrt(5))
    penup()
  =   left(18)
    penup()
    = forward(R)
    pendown()   =  
    left(162)
    = forward(A)
    right(72)
    = forward(A)
    left(144)
    = forward(A)
    right(72)
    = forward(A)
    left(144)
    = forward(A)
    right(72)
    = forward(A)
    left(144)
    = forward(A)
    right(72)
    = forward(A)
    left(144)
    = forward(A)
    right(72)
    = forward(A)
    penup()
    = left(162)
    forward(R)
    = left(162)
  =  
showturtle()

def = fillstar(color):
    = fillcolor(color)
    begin_fill()
  =   star(25)
    end_fill()
  =   
red =3D = "red"
fillstar(red)

def = space(width):
    penup()
    = forward(2*width)
    = pendown()

space(25)

fill= star(red)
space(25)
fillstar(red)
space(25)<= /div>
fillstar(red)
space(25)
fillstar(red)
<= div>space(25)
fillstar(red)
space(25)

def row(width):
    = penup()
    right(90)
    = forward(width)
    right(90)
    = forward(11*width)
    right(180)
  =   pendown()
row(25)

for i in = range (5):
    = fillstar(red)
    = space(25)

row(25)

fi= llstar(red)
space(25)
fillstar(red)
space(25= )
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fill= star(red)
space(25)

row(25)
<= br>
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fi= llstar(red)
space(25)
fillstar(red)
space(25= )

row(25)

fillstar(red)<= /div>
space(25)
fillstar(red)
space(25)
= fillstar(red)
space(25)
fillstar(red)
space(= 25)
fillstar(red)
space(25)
fillstar(red)
space(25)

row(25)

fillstar(red)
space(25)
fillstar(red)
spac= e(25)
fillstar(red)
space(25)
fillstar(red)<= /div>
space(25)
fillstar(red)
space(25)
=
row(25)

fillstar(red)
sp= ace(25)
fillstar(red)
space(25)
fillstar(red= )
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
spac= e(25)

row(25)

fillstar(r= ed)
space(25)
fillstar(red)
space(25)
<= div>fillstar(red)
space(25)
fillstar(red)
sp= ace(25)
fillstar(red)
space(25)

row(25)

fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
= space(25)
fillstar(red)
space(25)
fillstar(r= ed)
space(25)
fillstar(red)
space(25)
<= div>

= --Apple-Mail=_0D378C84-1A43-42CB-9B80-77125A69D252--