Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #66957
| 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 | <swdunning@cox.net> |
| 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 <swdunning@cox.net> |
| In-Reply-To | <VknC1n00H3bjUJS01knDZl> |
| Date | Sun, 23 Feb 2014 18:24:44 -0700 |
| References | <mailman.7276.1393141556.18130.python-list@python.org> <VknC1n00H3bjUJS01knDZl> |
| To | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
| 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 <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.7299.1393205088.18130.python-list@python.org> (permalink) |
| 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 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On Feb 23, 2014, at 1:44 AM, Steven D'Aprano <steve+comp.lang.python@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’ll put it below, sorry that it’s 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’t 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’m going to try and do what Rhodri suggested, a range function? I’m not sure exactly what that’ll do but I think it’ll clean up my code more and make things easier to call?
from turtle import *
from math import sin, sqrt, radians
def star(width):
R = (width)/(2*sin(radians(72)))
A = (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 = "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)
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Functions help Scott W Dunning <swdunning@cox.net> - 2014-02-22 22:43 -0700
Re: Functions help Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-23 08:44 +0000
Re: Functions help alex23 <wuwei23@gmail.com> - 2014-02-24 10:55 +1000
Re: Functions help Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-24 01:09 +0000
Re: Functions help alex23 <wuwei23@gmail.com> - 2014-02-24 11:39 +1000
Re: Functions help Benjamin Kaplan <benjamin.kaplan@case.edu> - 2014-02-23 18:55 -0800
Re: Functions help Grant Edwards <invalid@invalid.invalid> - 2014-02-24 15:38 +0000
Re: Functions help Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-24 03:21 +0000
Re: Functions help rurpy@yahoo.com - 2014-02-23 20:01 -0800
Re: Functions help Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-24 13:59 +0000
Re: Functions help Ethan Furman <ethan@stoneleaf.us> - 2014-02-25 18:52 -0800
Re: Functions help rurpy@yahoo.com - 2014-02-26 17:06 -0800
Re: Functions help MRAB <python@mrabarnett.plus.com> - 2014-02-24 03:36 +0000
Re: Functions help Scott W Dunning <swdunning@cox.net> - 2014-02-23 18:43 -0700
Re: Functions help Roy Smith <roy@panix.com> - 2014-02-23 20:28 -0500
Re: Functions help Travis Griggs <travisgriggs@gmail.com> - 2014-02-23 17:27 -0800
Re: Functions help "Rhodri James" <rhodri@wildebst.org.uk> - 2014-02-24 01:01 +0000
Re: Functions help Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-02-24 21:18 -0500
Re: Functions help "Rhodri James" <rhodri@wildebst.org.uk> - 2014-02-27 22:49 +0000
Re: Functions help Scott W Dunning <swdunning@cox.net> - 2014-02-23 18:24 -0700
Re: Functions help sffjunkie@gmail.com - 2014-02-24 02:15 -0800
Re: Functions help sffjunkie@gmail.com - 2014-02-24 02:32 -0800
csiph-web