Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #66873
| Subject | Re: Function and turtle help |
|---|---|
| From | Scott W Dunning <swdunning@cox.net> |
| Date | 2014-02-21 20:38 -0700 |
| References | <75339005-9609-48D8-9DEF-EF0B0CEE7B39@cox.net> <UuUh1n00f3bjUJS01uUiDR> <BBBC49EA-CB3E-4FBA-AB9C-887B6F5FFE2A@cox.net> <VEC21n00t3bjUJS01EC4BR> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.7251.1393041974.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
On Feb 21, 2014, at 7:13 PM, Dave Angel <davea@davea.name> wrote:
> Scott W Dunning <swdunning@cox.net> Wrote in message:
>>
>> On Feb 20, 2014, at 11:30 PM, Dave Angel <davea@davea.name> wrote:
>>
>>> Look at turtle.begin_fill and turtle.end_fill
>>>
>>> That's after making sure your star is a closed shape.
>>
>>
>>
>> So, this is what I have so far and it “works” but, it fills in the star with black and as you can see below I am trying to fill it in with red. So I’m obviously messing up somewhere.
>>
>> def fillcolor(red):
>> pencolor()
>> begin_fill()
>> star(500)
>> end_fill()
>>
>> red = pencolor
>> fillcolor(red)
>>
>
> You seem to have a fundamental misunderstanding of how variables
> and function parameters work.
Yes I just learned a little bit about functions a couple days ago in school. I am completely new to programming so thanks for any help!
>
>> def fillcolor(red):
> The parameter should be something like color, not red.
Ok I see.
I changed it a little based on what you suggested and I got a change, the outline became red but the fill is still black. Can you walk me through where I’m going wrong on what I have below?
From what I gather, I have a function called fillcolor with a parameter called color. I know this is going to sound stupid but I get a little lost after that. The function says when ever I call fillcolor do what’s in the body? What exactly does the parameter do (in this case color, how is that doing anything) and what is an argument?
def fillcolor(color): <- Function with parameter, right?
pencolor(color) <- Says make pencolor whatever I state when I call fill color, right?
begin_fill() <- starts filling the star. When I put color in () though I get an error that it takes no arguments?
star(500) <- Star function
end_fill() <- Ends fill
red = "red"
fillcolor(red)
I know that I know absolutely nothing but I’m trying and I just started so please bare with me. And thanks for any help, it's GREATLY appreciated!!
Scott
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Function and turtle help Scott W Dunning <swdunning@cox.net> - 2014-02-21 20:38 -0700
csiph-web