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


Groups > comp.lang.python > #39125

Re: request for help

Date 2013-02-18 11:54 -0800
From Gary Herron <gary.herron@islandtraining.com>
Subject Re: request for help
References <B7C01624-32AB-49CE-AAB4-064A5B8E54CB@icloud.com>
Newsgroups comp.lang.python
Message-ID <mailman.1968.1361217702.2939.python-list@python.org> (permalink)

Show all headers | View raw


On 02/18/2013 11:42 AM, leonardo selmi wrote:
> pls i need help:
>
> i have copied the following from a book and tried to make it work:
>
> import math
>
> def area(radius):
> return math.pi * radius**2
>
> def circumference(radius):
> return 2 * math.pi * radius
>
> i saved the above program from python shell into a file as "circle.py" . when i type "import circle" i get  error..
>
>
> kind regards

First, you shouldn't ask us to help you fix an error without telling us 
what the error is!   You should also tell us what version of Python and 
what system (Windows? Linux? ...) , and anything more that can help us 
understand what you did and what failed.


So this is just guesswork:
Spaces are important in Python.  The body of a function **must** be 
indented.  If you do have the indents in your code, and they were just 
lost in the process of cutting and pasting and emailing, the we really 
do need more information.

def area(radius):
     return math.pi * radius**2

def circumference(radius):
     return 2 * math.pi * radius

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: request for help Gary Herron <gary.herron@islandtraining.com> - 2013-02-18 11:54 -0800

csiph-web