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


Groups > comp.lang.python > #39125 > unrolled thread

Re: request for help

Started byGary Herron <gary.herron@islandtraining.com>
First post2013-02-18 11:54 -0800
Last post2013-02-18 11:54 -0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#39125 — Re: request for help

FromGary Herron <gary.herron@islandtraining.com>
Date2013-02-18 11:54 -0800
SubjectRe: request for help
Message-ID<mailman.1968.1361217702.2939.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web